Return to Snippet

Revision: 35514
at November 9, 2010 21:45 by telltec


Initial Code
<?php if ( is_page() ) { ?>

<?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) { ?>

<li>
<h2>
<?php
$parent_title = get_the_title($post->post_parent);
echo $parent_title;
?>
</h2>

<ul>
<?php echo $children; ?>
</ul>
</li>

<?php } } ?>

Initial URL
http://www.tammyhartdesigns.com/tutorials/wordpress-how-to-list-child-pages-in-sidebar/

Initial Description

                                

Initial Title
List Child Pages

Initial Tags
wordpress

Initial Language
PHP