Child theme of Twenty Seventeen with adjustments for an one page / single page site.
- Page slugs as anchors! 🦄
- Updates anchor in URL (location) when scrolling! 🦄
- Menu link is highlighted when linked page is scrolled in. 🦄
- Fixed anchor offset (when admin bar on frontend is shown).
- Uses the Bootstrap Scrollspy plugin.
- Live example with Docker container.
- Create a single, normal page for each section in WordPress.
- In Customizer, set the 'Static Front Page' option to the page to be shown as first section.
- In Customizer, in "Theme Options", define the sections.
- If you need more than the default 4 sections, enable and adjust this commented out code in functions.php (#2):
/*
* A simple function to control the number of Twenty Seventeen Theme Front Page Sections
* Source: wpcolt.com
*/
function twentyseventeen_custom_front_sections( $num_sections ) {
return 7; // Change this number to change the number of the sections.
}
add_filter( 'twentyseventeen_front_page_sections', 'twentyseventeen_custom_front_sections' );
-
In Menu settings, create a new menu and create new menu items of type 'Custom Link'. The 'page-slug' is showing on every Page directly after the input field for the page title ('Permalink:'). The 'page slug' is the last part. E.g.: http://test.domain.com/page-1 → 'page-1' → URL='/#page-1'. Use
/
for index page in case you still have sub-pages so the links can go back. -
For smooth scrolling you can install the Wordpress-Plugin jQuery Smooth Scroll.
See README in live-demo/.
Make top navigation always sticky (also sticky on mobile).
Thanks to @nydeggerm for README improvements.