Posted By

innerstorm on 10/07/11


Tagged

page wordpress subpage


Versions (?)

List subpages of current page


 / Published in: PHP
 

  1. function list_sub_pages () {
  2. global $wp_query;
  3. if( empty($wp_query->post->post_parent) ) {
  4. $parent = $wp_query->post->ID;
  5. echo "<h3>".get_the_title($parent)."</h3>";
  6. } else {
  7. $parent = $wp_query->post->post_parent;
  8. echo "<h3><a href='".get_permalink($parent)."'>".get_the_title($parent)."</a></h3>";
  9. }
  10. echo '<ul>';
  11. wp_list_pages("title_li=&child_of=$parent" );
  12. echo '</ul>';
  13. }

Report this snippet  

You need to login to post a comment.