Skip to content

Instantly share code, notes, and snippets.

@spencejs
Created August 27, 2013 07:20
Show Gist options
  • Save spencejs/6350588 to your computer and use it in GitHub Desktop.
Save spencejs/6350588 to your computer and use it in GitHub Desktop.
<?php
$images =& get_children( array (
'post_parent' => $post->ID,
'post_type' => 'attachment',
'post_mime_type' => 'image'
));
if ( empty($images) ) {
// no attachments here
} else {
foreach ( $images as $attachment_id => $attachment ) {
echo wp_get_attachment_image( $attachment_id, 'thumbnail' );
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment