Instead of using sidebar widgets to tell on what page they should be visible, I like to choose at the menu settings to appear on specific pages.
Default WordPress way:
So projects is a page and has some subpages. But what if I have like 10 more of these pages and subpages with the same situation.
I would like to add an extra setting (a list of the top level pages):
But I cannot find any documentation, actions, filters etc when these settings are loaded.
7 s
That’s a nice option, but I agree with sri, right now it really depends on your theme.
You can do a work-around through is_page(). You need to write something like this on your page.php theme file:
<?php
if (is_page('projects')) {
if ( is_active_sidebar( 'sidebar-navigation' )) {
dynamic_sidebar( 'sidebar-navigation' );
}
}
?>
If you want to show the sidebar on other pages as well, you can use logic or like this:
if (is_page('projects') || is_page('home') || is_page('post-page'))