WP_Query Example:

<?php

$args = array(
‘post_parent’ => 42,
‘post_type’ => ‘page’
);

$query = new WP_Query( $args );

print_r($query);

// The Loop
while ( $query->have_posts() ) : $query->the_post();
echo ‘<li>’;
the_title();
echo ‘</li>’;
endwhile;

// Reset Post Data
wp_reset_postdata();?>

Advertisements