I try to achieve the following layout with WordPress 3.2.1:
---> ID 4 (Record 2, 3rd Attempt)
--> ID 3 (Record 2, 2nd Attempt)
-> ID 2 (Record 2, 1st Attempt)
--> ID 5 (Record 1, 2nd Attempt)
-> ID 1 (Record 1, 1st Attempt)
Every line represents a page and on the Backend the page hierarchy looks like that:
-> ID 1
--> ID 5
-> ID 2
--> ID 3
---> ID 4
I’m sorry I prepared a nice illustration but I’m not yet allowed to post images. So, to explain it a bit further: I try to build a list of records and as soon as one of the records gets broken, it will shift to the right and on top of it the newest record attempt appears.
Ok, so first question: How do I have to set up query_posts to recursively get all children? The following code only returns page 3 but not 4:
<?php query_posts(array('post_parent' => 2, 'post_type' => 'page')); ?>
And second question: Does anyone know a better/simpler/sexier (WordPress) solution for what I try to achieve?
try
you can look it up in the WP Codex here: http://codex.wordpress.org/Function_Reference/get_pages