Posted By

raz on 01/26/11


Tagged

pages list wordpress subpages Parent


Versions (?)

List WordPress subpages and include parent


 / Published in: PHP
 

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

List WordPress subpages and include parent

  1. <?php
  2. if($post->post_parent)
  3. $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
  4. else
  5. $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
  6. if ($children) {
  7. $parent_title = get_the_title($post->post_parent);?>
  8. <li><a href="<?php echo get_permalink($post->post_parent) ?>"><?php echo $parent_title;?></a></li>
  9. <?php echo $children; ?>
  10. <?php } ?>

Report this snippet  

You need to login to post a comment.