/ Published in: PHP

his code will show the child pages, and only the child pages, when on a parent or on one of the children.
This code will not work if placed after a widget block in the sidebar.
This code will not work if placed after a widget block in the sidebar.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php if($post->post_parent) $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0"); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } ?>
URL: http://codex.wordpress.org/Function_Reference/wp_list_pages
Comments
