/ Published in: PHP

use this in the sidebar to show a top level page with child pages persistently
Expand |
Embed | Plain Text
<ul><?php $parent_title = get_the_title($post->post_parent);?> <?php if ($post->post_parent) { $ancestors=get_post_ancestors($post->ID); $parent = $ancestors[$root]; } else { $parent = $post->ID; } $children = wp_list_pages("title_li=&child_of=". $parent ."&echo=0"); if ($children) { ?> <ul id="subnav"> </ul> <?php } ?>
You need to login to post a comment.