Showing subpages’ subpages only if…
-
Hi,
I’m looking for a way to show my 3rd level navigation (subpages’ subpages) only when the corresponding 2nd or 3rd level link is loaded. Example to make it clearer:
Parent
Child 1
Child 2
Child 2.1
Child 2.2
Child 3Child 2.1 and 2.2 should only show up when:
– Child 2 has been loaded
– Either Child 2.1 or 2.2 have been loaded.Currently, I’m using the following code to seperate the 1st level parents from the 2nd/3rd level children (the 1st level nav is in the header, while the 2nd/3rd only appeard in the sidebar.php)
<?php $children = ($post->post_parent) ? wp_list_pages('title_li=&child_of='.$post->post_parent.'&echo=0') : wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0'); if($children) { echo('<ul id="navig">'.$children.'</ul>'); } ?>
Many thanks in advance for your help!
- The topic ‘Showing subpages’ subpages only if…’ is closed to new replies.