Hi I am using Wordpress 3.3.2, I created my own theme. NO MENUS on home page on two Box have some text which linked with 2 different Page.(Mid-Cap and SMES). Problem Description: I need different menus for each the pages. For example - If I click on Mid-Cap box on home page then Mid-Cap page will open and menus Will be MID1 MID2 MID3 And if I click on SMES box on home page then SMES page will open and menus Will be SMES1 SMES2 SMES3 SMES4 SMES5 My custom menu code - function.php- <?php register_nav_menus( array('Menu1' => 'MyMenu1', 'Menu2' > 'MyMenu2', ) );?> header.php- <div id="container"> <?php if(is_page()): ?> <div class="banner"> </div> <div id="menu"> <?php wp_nav_menu(array( 'name' => 'MyMenu1' )); wp_nav_menu(array( 'name' => 'MyMenu2' )); ?> </div> By this code, ALL page links are displaying side by side twice. Like this - MID1 MID2 MID3 SMES1 SMES2 SMES3 SMES4 SMES5 MID1 MID2 MID3 SMES1 SMES2 SMES3 SMES4 SMES5 But I don't want SMES page Links on MID-CAP pages. And MID-CAP pages links on SMES pages. Please see the attached image cutLogo.jpg is the center ofHome page and RepeatedMenu.jpg is partial part of SMES page. How can I solve my problem. Regards to ALL
You could try something like this, you need to put some logic so that the menu knows which page you are on. <?php if ( is_page() ) { echo '<div class="banner"> </div>'; echo '<div id="menu">'; if ( is_page( 'mid' ) { wp_nav_menu( array( 'name' => 'MyMenu1' )); } elseif ( is_page( 'sem' ) { wp_nav_menu(array( 'name' => 'MyMenu2' )); } echo '</div>'; } PHP:
No change... Actually I am not able to figure how to link pages (MID1 MID2 MID3 MID4) under MyMenu1 and pages (SMES1 SMES2 SMES3 SMES4) under MyMenu2. Do I need to create menu in Word Press Dash board under Appearance->Menus
I got my solution the only bitter part of the solution is styling is very thorny- I am talking about wp_list_pages(args..). This function return the in UL list which is not possible to override directly by our custom style. But there are way around to do it. Follow these links - http://wordpress.org/support/topic/different-menus-on-different-pages http://wordpress.org/support/topic/problem-styling-wp_list_pages-output-current_page_item http://www.wantusiak.com/wordpress/wordpress-how-to-style-wp_list_pages Very helpful discussions for customizing different menus on different pages. I am still working on this