I'm using this code to get a random list of pages:
<?php
$postid = $post->ID;
$args = array(
'post_type' => 'page',
'post_status' => 'publish',
'orderby' => 'rand',
'showposts' => 5,
'post__not_in' => array($postid)
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endwhile;
}
wp_reset_query();
?>
This shows all pages, but I would like to display not all of them, just pages which are granchildren, how can I do that?