Skip to content

Instantly share code, notes, and snippets.

@vajrasar
Created September 6, 2014 07:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vajrasar/f9541363ded41d09d8a6 to your computer and use it in GitHub Desktop.
Save vajrasar/f9541363ded41d09d8a6 to your computer and use it in GitHub Desktop.
Replace Primary Navigation conditionally with other Menu in Genesis (Modified)
<?php //* Do not include opening php tag
/*
Add Conditional of where you want your custom Menu to show (insted of Primary)
*/
add_action( 'genesis_header', 'sk_replace_menu_in_primary' );
function sk_replace_menu_in_primary() {
if( is_page() ) { // Put your conditional here
add_filter( 'wp_nav_menu_args', 'replace_menu_in_primary' );
}
}
/*
Insert the Menu Name of the menu you made to replace the Primary one
*/
function replace_menu_in_primary( $args ) {
if ( $args['theme_location'] == 'primary' ) {
$args['menu'] = 'Your Custom Menu'; //Name of the custom menu that you would like to display in Primary Navigation Location when the above conditional is met
}
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment