Parent of a Parent
-
SO I have a custom navigation structure that worked great with only two levels. Now that I have a third level problems have risen.
Here’s the code.
<div id=”main_nav”>
-
<?php wp_list_pages(‘sort_column=menu_order&title_li=&depth=1’); ?>
</div>
<div id=”sub_nav”>-
<?php
if($post->post_parent) { // page is a child
wp_list_pages(‘sort_column=menu_order&title_li=&child_of=’.$post->post_parent);
} elseif(wp_list_pages(“child_of=”.$post->ID.”&echo=0″)) { // page has children
wp_list_pages(‘sort_column=menu_order&title_li=&child_of=’.$post->ID);
}
?></div>
Now, how can I tell the second level to only show the second level? It shows the third level when on the third level.
- The topic ‘Parent of a Parent’ is closed to new replies.