• I have the following structure of pages:

    PageA
      - PageA1
      - PageA2
      - PageA3
    PageB
      - PageB1
      - PageB2
      - PageB3

    What I’m trying to achieve, is having two separate menus in header:
    PageA PageB

    and below this menu, depending on chosen page, separate submenu:
    PageA1 PageA2 PageA3
    or
    PageB1 PageB2 PageB3

    Any ideas of getting this done?

Viewing 1 replies (of 1 total)
  • What you want to do is use conditionals… so something like:

    <?php if (is_page(2) || $post->post_parent==2) {?>
    
    		<?php wp_nav_menu( array( 'menu' => 'PageA', ' sort_column' => 'menu_order', 'menu_id' => 'sub-nav' ) ); ?>
    
    	<?php } else { ?>
    
    		<?php wp_nav_menu( array( 'menu' => 'PageB', ' sort_column' => 'menu_order', 'menu_id' => 'sub-nav' ) ); ?>
    
    	<?php } ?>

    This means that page a is number 2. You need to use your page id and of course set up the 2 menus you want to use on either page.

Viewing 1 replies (of 1 total)
  • The topic ‘Second-level, separate menu depending on choice from main menu’ is closed to new replies.