In GenesisWP Facebook group, a user asked:
does anyone know of a good way to have a secondary nav menu display on single post template pages- and nowhere else? Or- perhaps on a few other select pages?
Adding the code below in child theme’s functions.php will display a menu assigned to Secondary Navigation Menu location only on single Posts and nowhere else:
// Show the custom menu assigned to Secondary Navigation Menu location only on single Posts | |
add_action( 'genesis_header', 'sk_show_secondary_navigaton' ); | |
function sk_show_secondary_navigaton() { | |
if ( is_singular( 'post' ) ) { | |
return; | |
} | |
remove_action( 'genesis_after_header', 'genesis_do_subnav' ); | |
} |
A sample single Post:
Non Post page:
wonderful! Thank you!
How easy would it be to display a unique secondary menu for each page on the site? So, for example, Page 1 has a secondary menu specific to its content as does Page 2 etc…
Possible by writing code.
But you may find https://wordpress.org/plugins/genesis-simple-menus/ easier to use for this purpose.