Skip to content

Instantly share code, notes, and snippets.

@jaibeee
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaibeee/793c5506dfe0ecb46db5 to your computer and use it in GitHub Desktop.
Save jaibeee/793c5506dfe0ecb46db5 to your computer and use it in GitHub Desktop.
<?php
// get pages
$pages = get_pages("child_of=".$post->ID.'&sort_column=post_title&sort_order=desc&parent='.$post->ID);
// loop through pages pages to get page properties
foreach($pages as $page) {
?>
<div class="wp-caption alignleft">
// create an hyperlink from the get_page_link method and embed the image retrieved from get_the_post_thumbnail in it
<a href="<?php echo get_page_link($page->ID) ?><?php echo get_the_post_thumbnail($page->ID); ?>
// get the title and use it as the caption
<?= $page->post_title ?>
</div>
// get the content
<?php echo $page->post_content; ?>
<?php edit_post_link('Edit.', '', '', $page->ID); ?>
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment