Out of the box, you can’t have a sidebar on pages with Twenty Seventeen theme. You can have one on posts, but not on pages.
Ok. Out of the box, but you probably guess that I’ve found a hack 😉 So, here is the way to…
For this hack, a child theme is required. If you have not created one, you can easily do it with this tuto: Create a Child Theme for Twenty Seventeen. Copy page.php
file from parent theme. Edit the file in the child theme. Add the following code between </div><!-- #primary -->
and </div><!-- .wrap -->
:
<?php get_sidebar(); ?>
In functions.php
file, add this:
function tsct_body_classes_child( $classes ){ if ( is_active_sidebar( 'sidebar-1' ) && is_page() ) { $classes[] = 'has-sidebar'; } return $classes; } add_filter( 'body_class', 'tsct_body_classes_child' );
That’s all folks! Your sidebar with widgets you choosed is now displayed on pages too. But if you want to have…
Copy the parent page.php
file to child theme, rename it page-with-sidebard.php
, edit the file, change code as explained above and replace * The template for displaying all pages
by * Template Name: With Sidebar
.
Now in pages templates, for each page, you can choose the most appropriate template, with or without sidebar.