Skip to content

Instantly share code, notes, and snippets.

@radiosilence
Created December 13, 2011 14:49
Show Gist options
  • Save radiosilence/1472381 to your computer and use it in GitHub Desktop.
Save radiosilence/1472381 to your computer and use it in GitHub Desktop.
<?php $args = array(
'post_type' => 'attachment',
'orderby' => 'menu_order',
'order' => 'ASC',
'post_mime_type' => 'image',
'post_status' => null,
'post_parent' => get_the_ID()
);
$attachments = get_posts($args);
$count=0; $i=0;
if ($attachments) :
foreach ( $attachments as $attachment ) :
if ($i > 3) { break; } ?>
<a href="<?php the_permalink() ?>">
<?php echo wp_get_attachment_image( $attachment->ID , 'col-'.$figure_width ); ?>
</a>
<?php $count++;
endforeach;
endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment