• Resolved jimmyt1988

    (@jimmyt1988)


    How do i get a list of the current pages parents and children (the titles).

    All I can find out is how to get the children of the current page which is useless for me.

Viewing 1 replies (of 1 total)
  • Thread Starter jimmyt1988

    (@jimmyt1988)

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
            <?php
                if ($post->post_parent)	{
                	$ancestors=get_post_ancestors($post->ID);
                	$root=count($ancestors)-1;
                	$parent = $ancestors[$root];
                } else {
                	$parent = $post->ID;
                }
    
                $children = get_pages("title_li=&child_of=". $parent ."&echo=0");
    
                if ($children) { ?>
                    <?php
                    foreach($children as $output){ ?>
Viewing 1 replies (of 1 total)
  • The topic ‘list of current pages parents and children?’ is closed to new replies.