Support » Plugins » DIsplay Image Caption – Advanced Custom Field Repeater.

  • I would like to display the image’s (attachment’s) ‘caption’ in an Advanced Custom Fields repeater image field. From what I’ve read the ‘caption’ is stored as the attachment’s ‘post_excerpt’ however I don’t know how to get that and insert it in my current code (below). Thanks.

    <?php if(get_field('images')): ?>
    <?php while(the_repeater_field('images')): ?>
    <?php $image = wp_get_attachment_image_src(get_sub_field('image'), 'large'); ?>
    <?php $PostImage = wp_get_attachment_image_src(get_sub_field('image'), 'thumbnail'); ?>
    <a title="View large image" href="<?php echo $image[0]; ?>" >
    <img src="<?php echo $PostImage[0]; ?>" alt="<?php echo ADD IMAGE CAPTION HERE PLEASE! ?>" />
    <?php endwhile; ?>
    <?php endif; ?>
  • The topic ‘DIsplay Image Caption – Advanced Custom Field Repeater.’ is closed to new replies.