Skip to content

Instantly share code, notes, and snippets.

@jrthib
Last active December 16, 2015 15:18
Show Gist options
  • Save jrthib/5454506 to your computer and use it in GitHub Desktop.
Save jrthib/5454506 to your computer and use it in GitHub Desktop.
Wordpress example that retrieves child pages and outputs them
<?php
query_posts(
array(
'showposts' => 20,
'post_parent' => $page_id,
'post_type' => 'page',
'order' => 'ASC'
)
);
$i = 0;
while (have_posts()) : the_post(); ?>
<?php $slug = basename(get_permalink()); ?>
<div id="<?php echo $slug; ?>" class="pane">
<div class="content">
<div class="inner">
<h2 class="title"><?php the_title(); ?></h2>
<?php the_content(); ?>
</div>
</div>
</div>
<?php $i++; ?>
<?php endwhile; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment