The following snippet will let you show top level and child pages in WordPress.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <ul><?php $parent_title = get_the_title($post->post_parent);?> <li><a href="<?php echo get_permalink($post->post_parent) ?>"><?php echo $parent_title;?></a></li></ul> <?php if ($post->post_parent) { $ancestors=get_post_ancestors($post->ID); $root=count($ancestors)-1; $parent = $ancestors[$root]; } else { $parent = $post->ID; } $children = wp_list_pages("title_li=&child_of=". $parent ."&echo=0"); if ($children) { ?> <ul id="subnav"> <?php echo $children; ?> </ul> <?php } ?> |