• <?php if ( is_page('direct-sellers') ) { ?>
    <?php wp_nav_menu( array('theme_location' => 'side-menu-1' ) ); ?>
      <?php } elseif ( is_page('eretailers') ){ ?>
    <?php wp_nav_menu( array('theme_location' => 'side-menu-2' ) ); ?>
      <?php } ?>

    That’s the code I have so far, and they display correctly on the parent page but my problem is I’m not sure how to display the menus on each child pages of the parent without creating a huge hard coded elseif statement.

    I guess I’m looking for a way to ask the server what page it is then ask if that page is a child of either of those pages, so it displays the page and the side nav correctly.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Seth@eyelevel

    (@setheyelevel)

    I’ve made some progress on my issue with this following code:

    <?php if ($post->post_parent || is_page ('direct-sellers')  ) {  ?>
    <?php wp_nav_menu( array('theme_location' => 'side-menu-1' ) ); ?>
    <?php } elseif ($post->post_parent || is_page ('eretailers')  ) {  ?>
    <?php wp_nav_menu( array('theme_location' => 'side-menu-2' ) ); ?>
    <?php } else ?>

    but now my issue is when I am on the eretailer page and navigate to a child of eretailer is displays the side nav for direct sellers. I guess I’m not sure how to distinguish between the two parent pages effectively.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Way to define if a page is the child of a specific parent page.’ is closed to new replies.