Created
September 12, 2016 22:23
-
-
Save grantambrose/5be3b8d1ff48030099b6645637079d9b to your computer and use it in GitHub Desktop.
WordPress: Change the main menu on different pages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Conditionally change menus | |
add_filter( 'wp_nav_menu_args', 'bb_wp_nav_menu_args' ); | |
function bb_wp_nav_menu_args( $args = '' ) { | |
// change the menu in the Header menu position | |
if( $args['theme_location'] == 'header' && is_page('1159') ) { | |
$args['menu'] = '32'; // 32 is the ID of the menu we want to use here | |
} | |
return $args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
Please let me know how I can locate both the wordpress filter and the theme filter. Because I've tried this with my theme but it didn't work