Basically, I want to query PARENT for a bunch of custom field data and echo it out. Then, I want to query all of the CHILD pages of that parent and echo out more data.
What's the best way to do it?
- Top level query for parent then within that query a sublevel a query for the children.
- 2 seperate top level queries
Best to use
get_posts or combination of both?
UPDATE: Looks like I might have to explain a little better.
If the structure of pages looks like this:
Page Parent ID(2) 1. Child 1 ID(3) 2. Child 2 ID(4) 3. Child 3 ID(5) 4. Child 4 ID(6)
And the parent query looks like this:
$parent = new wp_query(post_id=2) while //do page parent stuff, eg get the_title(); of the parent page endwhile
Do I have to run another instance of wp_query to get the child pages, using
post_parent=2, or can I somehow re-use the original parent query and extend it with extra parameters to cut down on query calls?
I'm looking for optimisation of the wp_query here when a child query uses the same parameters as the parent plus a couple more. Thanks.