Advertisement
alchymyth

page list of children of level 2

Jun 9th, 2011
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.52 KB | None | 0 0
  1. function grandchild_level_list_pages() {
  2. global $post;
  3. $pages_tree = array_reverse(get_post_ancestors($post->ID));
  4. $pages_tree = array_merge($pages_tree, array($post->ID));
  5. if(is_page() && $pages_tree[1]) :
  6. $this_page = $pages_tree[1];
  7. // a condition that shows this list in the ancestry of the current page
  8. $plist = wp_list_pages('title_li=&child_of=' . $this_page .'&depth=1&echo=0');
  9. if(plist) { ?>
  10.  
  11. <ul class="menu layer-grandchild">
  12. <?php echo $plist; ?>
  13. </ul>
  14.  
  15. <?php }
  16. endif; //end if($pages_tree[1])
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement