Using the following snippet, you will be able to have custom menus for different category/page/post.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | <?php // add the following to wp theme function.php register_nav_menus( array( 'primary-menu' => 'main menu', 'marketing-menu' => 'marketing menu', 'shopping menu' => 'shopping menu', 'technology menu' => 'technology menu', 'recreation menu' => 'recreation menu', ) ); add_action( 'init', 'register_nav_menus' ); ?> <?php // add following to where you want the menu share, in my case, hearder.php <?php if((has_nav_menu('marketing-menu') and !is_home() and is_category(array(5,6,8,9,10,11,12,13,14))) or (has_nav_menu('marketing-menu') and !is_home() and in_category(array(5,6,8,9,10,11,12,13,14)))) { wp_nav_menu(array( 'theme_location' => 'marketing-menu', 'container' => '', 'menu_id' => 'primary-nav', 'container_class' => 'main-menu', 'menu_class' => 'nav' )); } else(has_nav_menu('primary-menu')){ wp_nav_menu(array( 'theme_location' => 'primary-menu', 'container' => '', 'menu_id' => 'primary-nav', 'container_class' => 'main-menu', 'menu_class' => 'nav' )); ?> |