Return to Snippet

Revision: 40140
at January 26, 2011 21:50 by raz


Initial Code
<?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) {
$parent_title = get_the_title($post->post_parent);?>
<li><a href="<?php echo get_permalink($post->post_parent) ?>"><?php echo $parent_title;?></a></li>
  <?php echo $children; ?>
  <?php } ?>

Initial URL
http://wordpress.org/support/topic/including-the-parent-page-in-a-list-of-subpages

Initial Description
List WordPress subpages and include parent

Initial Title
List WordPress subpages and include parent

Initial Tags
list, wordpress

Initial Language
PHP