Support » Plugins » Hacks » Getting post images and captions only!?

  • Hi!
    I’m trying to get only my post images and their captions to display both on my index and on my single pages. The images are working fine, but no-matter what I try, I’m not getting captions. Please help!!!!

    This is what I have that works for the images:

    <?php
       $attachments = get_children( array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' => 'image','caption' => $attachment->post_excerpt) );
          foreach ( $attachments as $attachment_id => $attachment ) {
             echo wp_get_attachment_image($attachment_id, 'full' );
          }
    ?>

  • The topic ‘Getting post images and captions only!?’ is closed to new replies.