Skip to content

Instantly share code, notes, and snippets.

@ianthekid
Last active November 24, 2015 06:25
Show Gist options
  • Save ianthekid/e66f11c86f2a2a4bb462 to your computer and use it in GitHub Desktop.
Save ianthekid/e66f11c86f2a2a4bb462 to your computer and use it in GitHub Desktop.
Wordpress Comments for Attachment Images in Post Loop
<?php
//Place this within The Loop of post_parent ($post)
$args = array( 'post_type' => 'attachment',
'numberposts' => -1,
'post_parent' => $post->ID );
$attachments = new WP_query($args);
while ($attachments->have_posts()) :
$attachments->the_post();
echo wp_get_attachment_image( get_the_ID(), 'medium');
comments_template();
endwhile;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment