Skip to content

Instantly share code, notes, and snippets.

@schalkburger
Last active August 29, 2015 14:15
Show Gist options
  • Save schalkburger/1e827aa086af704fa9ea to your computer and use it in GitHub Desktop.
Save schalkburger/1e827aa086af704fa9ea to your computer and use it in GitHub Desktop.
Wordpress list page children content
<?php
$args = array(
'post_type' => 'page',
'numberposts' => 99,
'post_status' => 'publish',
'order' => 'ASC',
'post_parent' => 1, // Any post parent
);
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $post) { ?>
<div class="child-page-item clearfix" id="post-<?php the_ID(); ?>">
<?php if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail())) : ?>
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_post_thumbnail(''); ?></a>
<?php else :?><?php endif;?>
<h3><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h3>
</div>
<?php
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment