Advertisement
olie480

WP - Get Child Pages from Parent

Feb 26th, 2013
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.55 KB | None | 0 0
  1.             <?php $page_parent = 10;?>
  2.         <?php //query_posts(array('showposts' => 1, 'orderby' => 'rand', 'post_parent' => $page_parent, 'post_type' => 'page')); while (have_posts()) { the_post(); ?>
  3.       <?php
  4.                         $args = array(
  5.                             'posts_per_page' => 1,
  6.                             'orderby' => 'rand',
  7.                             'post_parent' => $page_parent,
  8.                             'post_type' => 'page',                         
  9.                         );
  10.                         $pages = new WP_Query($args);
  11.             ?>         
  12.             <?php if($pages->have_posts()){ $pages->the_post(); ?>
  13.             <div class="the-title"><?php the_title(); ?></div>
  14.       <?php }?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement