Way to define if a page is the child of a specific parent page.
-
<?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)
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.