Created
December 30, 2014 09:13
-
-
Save thecodepoetry/58d76f1ba24c78240514 to your computer and use it in GitHub Desktop.
Custom menu filter for The7.2, Armada
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
add_filter( 'dt_menu_options', 'cp_custom_menu_filter' ); | |
function cp_custom_menu_filter( $options = array() ) { | |
global $post; | |
if ( 'primary' == $options['location'] ) { | |
if(is_page( 35 )) { //if page id 35 | |
$page_primary_menu = intval( 91 ); //display menu with id 91 | |
if ( $page_primary_menu > 0 ) { | |
$options['params']['menu'] = $page_primary_menu; | |
$options['params']['dt_has_nav_menu'] = true; | |
} else { | |
$options['force_fallback'] = true; | |
} | |
} | |
if(is_page( 45 )) { //if page id 45 | |
$page_primary_menu = intval( 92 ); //display menu with id 92 | |
if ( $page_primary_menu > 0 ) { | |
$options['params']['menu'] = $page_primary_menu; | |
$options['params']['dt_has_nav_menu'] = true; | |
} else { | |
$options['force_fallback'] = true; | |
} | |
} | |
} | |
return $options; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use this function in functions.php to load different primary menu according to pages (page id 35 will load menu with id 91)