Esmi,
Thanks!
Question though… it says it just returns ‘array’…. array of what? page objects? I need to go through each page and print stuff (just like the wordpress loop) but I’m not sure how to access the data in the returned array.
From what I recall, it retains an object/array of all of the child pages – content and all. Try running the example shown on that page and you’ll see exactly what is returned.
It did return objects/array… but of the 2 fake posts I made to the blog. Nothing page related.
The messed up part is that both of the posts have “post_parent” at 0…
for reference:
$my_wp_query=new WP_Query();
$all_wp_pages=$my_wp_query->query(array('post+type'=>'page'));//get all pages
$student_bios=get_page_by_title('student-bios');//gets page as object
$bios=get_page_children($student_bios->ID, $all_wp_pages);
echo '<pre>'.print_r($bios,true).'</pre>';
output:
[Code moderated as per the Forum Rules. Please use the pastebin]
solved it using “get_pages()” with the ‘child_of=’ modifier.
This works well. Also, I had to figure out what counts as ‘title’ by the get_page_by_title() method.
Thanks!