Last active
November 24, 2015 06:25
-
-
Save ianthekid/e66f11c86f2a2a4bb462 to your computer and use it in GitHub Desktop.
Wordpress Comments for Attachment Images in Post Loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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