If you’d like to build a one-page website, Polestar and SiteOrigin Page Builder make the job easy.
Add the page you’ll be using by going to PagesAdd New. If you’d like this page to be your home page, go to SettingsReading to assign it as your static home page once saved.
Next, we’ll set up the page design to make it suitable for a full-width one-page website. Edit your page and scroll down to the Page Settings meta box and set the Page Layout to No Sidebar. Disable the Header Bottom Margin and Footer Top Margin settings as we’d like our first and last rows to be flush with the header and footer. For our demo, we’ve also set the Header Overlap to Enabled – Light Text and disabled the Footer Widgets as it suits our page design.
Click on the Page Builder tab to switch to the Page Builder interface. In this example, we’ll be using a pre-built layout to get started. Click the Layouts button and then Layouts Directory on the left. Select any of the pre-built layouts then click the Insert button bottom right followed by Replace current.
Once inserted you can edit each section of the pre-built layout and insert your own content. You can, of course, build your one-pager from scratch using Page Builder but for this tutorial, we’ll use a pre-built layout to speed things up.
Our page is now set up. Our next task is to ready the page for navigation links that will take the user to each section. We’ll do this by inserting an ID in each row. From the Page Builder interface, edit the first row by clicking the wrench icon on the right then Edit Row. Click the Attributes heading in the right column and locate the Row ID field at the top. Type a word to identify this row, for example, if your first row had information about the page/service/company you might enter about as the ID. Once inserted, click the Done button at the bottom right of the modal window and repeat this process for each row. Each ID should be unique.
Go to AppearanceMenus. If you don’t yet have a custom menu created and assigned to Polestar’s Header Menu location, click create a new menu, name your menu and use the checkbox at the bottom of the page to assign it to the theme’s Header Menu location.
To insert links to your page sections, click Custom Links in the left column, in the URL field, insert a hash followed by the name of your first row ID. For example, #about, assuming about was the name of your first ID. In the Link Text field, insert the menu item label, this is what users will see. Click Add to Menu. Repeat this process for all of your section IDs. Finally, click Save Menu.
In the above paragraph we used section links as follows:
If other pages are present in your menu you can use the full URL:
If you’d like to smooth scroll from a link outside of the main menu, simply add the following class to it:
An example of this class added to a link:
<a href="#colophon" class="puro-scroll">Scroll to the footer</a>
When scrolling the menu will highlight using the current menu item color, the section that’s being viewed. When a link is clicked on, the page will smooth scroll to that section.
You might have noticed that our demo one-pager has a different menu to the rest of the demo site. We’ve done that using the plugin Menu Items Visibility Control. Once activated, it adds a Visibility field to each menu item in your menu. For all of our pages and links not included in the one-page demo, we’ve added the following to the Visibility field: ! is_page( 288 ). That’ll exclude all normal menu items from the page ID 288 which is the ID of our one-page demo. For all of the menu items in our once page demo, we’ve added to the visibility field is_page( 288 ). That’ll show our one-page menu items only on the one-page demo.