Hi,
I want to select (whith query_posts or WP_query) all my main pages without their children. I searched the codex but I was not able to find anything about it.
Anyone ?
Regards,
Jeremy
Hi,
I want to select (whith query_posts or WP_query) all my main pages without their children. I searched the codex but I was not able to find anything about it.
Anyone ?
Regards,
Jeremy
You can't have looked far. :-)
My purpose is to select pages to use them in the loop, can you do that with the function you linked me ?
In that case, see http://codex.wordpress.org/Function_Reference/WP_Query. Or combine get_pages with a simply foreach type loop.
I solved my problem. I simply used a condition :
<?php
query_posts( 'post_type=page' ); // select all the pages
if (have_posts() ) :
while (have_posts() ) : the_post();
if ( ! $post->post_parent ) : // filter the pages without parent
?>
<!-- THE LOOP -->This topic has been closed to new replies.