Support

Account

Home Forums General Issues Get the image using image ID in repeater Reply To: Get the image using image ID in repeater

  • You’ll need to use wp_get_attachment_image if your using the ID – maybe something like below – havnt tested but hopefully it’ll work

    <?php 
    if(get_field('image_gallery')): ?>
        <?php while(has_sub_field('image_gallery')): ?>
    <?php 
    $attachment_id = get_sub_field('illustrations_image');
    $size = "thumbnail"; // (thumbnail, medium, large, full or custom size)
    $imageurl = wp_get_attachment_image_src( $attachment_id, 'full' );
    $image_title = $attachment->post_title;
    ?>
            <a href="<?php echo $imageurl[0] ?>" title="<?php echo $image_title; ?>"><?php echo $img; ?></a>
        <?php endwhile; ?>									 
    <?php endif; ?>