What I would like to do is to create a WP loop that will display info from a child page of an adult page ID, so the Page ID is 2. I would like to pick a page ID to display what page.

So that way I could display information from another child page on an alternative page.


  • Please, add research efforts to your Question. Search the Codex for is_page, get_post and get_posts.
    – brasofilo
    Jan 25, 2013 at 15:58

1 Answer 1


This is a near duplicate of a number of questions here, but the "single random result" might make it somewhat distinct.

$args = array(
    'post_type'         => 'page',
    'post_parent'       => $post->ID,                               
    'orderby'           => 'rand',
    'posts_per_page'    => 1,
    'no_found_rows'     => true
$child = new WP_Query($args);

You are telling WP_Query to pick 1) pages, 2) with the parent of the current page, 3) ordered randomly, 4) one result, and 5) don't bother tracking found rows since we already know it should be 0 or 1.

There are numerous examples of creating multiple loops here and in the Codex. You should be able to find plenty of information to flesh this out. In short you want:

while ($child->have_posts()) {
  var_dump($post); // raw dump of your child post

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.