Total Pageviews

Monday, March 19, 2012

Using Wordpress LOOP with pages instead of posts

You can query a set of child pages, and then use THE LOOP function calls on it .

you can use 


<?php 

query_posts(array('showposts' => <number_of_pages_to_show>, 'post_parent' => <ID of the parent page>, 'post_type' => 'page'));
while (have_posts()) { the_post();
    /* Do whatever you want to do for every page... */
}
//  don't forget to end the while. 
wp_reset_query();  // Restore global post data
?>