klitscher
Member
Posted 1 year ago #
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?
mumebuhi
Member
Posted 9 months ago #
Strangely enough, I could not get this to work on 2.5.1 as well. Thoughts?
karl19
Member
Posted 7 months ago #
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.
ittekudasai
Member
Posted 5 months ago #
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.
karl19
Member
Posted 3 months ago #
Here is another way of getting the children of pages (you can even get the grand children) - query-child-of-page
jwalin
Member
Posted 2 months ago #
try number attribute with chile_of attribute.