• Resolved klitscher

    (@klitscher)


    I’m using 2.7 B1 and trying to list the child pages of the page in the post content area. I have a shortcode plugin working, but can’t narrow down the pages to just the children:

    $pages = get_pages('child_of=65');
    
        $count = 0;
        foreach($pages as $page)
        {
            ?>
    	<h2><a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?></a></h2>
           	<?php
    
    }
    	}

    When I put in a valid Page ID I get no results. When I change it to 0 (all) or leave the child_of parameter out I get all of the pages listed. Any thoughts?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Strangely enough, I could not get this to work on 2.5.1 as well. Thoughts?

    The above works fine for me, as long as I take out the last curly bracket, since there is one too many. I’m using WP 2.7.1.

    It’s not working for me. $post-ID is returning a bad ID, which doesn’t have children.

    Perhaps I just need to nuke my DB? I’m in development so that’s not the end of the world, but I’ve about had it trying to make child_of work right now.

    Here is another way of getting the children of pages (you can even get the grand children) – query-child-of-page

    try number attribute with chile_of attribute.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘child_of not working in get_pages’ is closed to new replies.