Support

Account

Home Forums Add-ons Repeater Field Displaying Thumbnails with Repeater field Reply To: Displaying Thumbnails with Repeater field

  • Hi @harryadf

    Your code has a few issues, but the main one is that you are not using the $thumb variable after you populate it with a value!

    Within your loop, you have code which finds the thumb:

    
    <?php $thumb = wp_get_attachment_image_src(get_sub_field('image'), 'thumbnail' ); ?>
    

    But then you ignore that value and just echo out the image like so:

    
    <img src="<?php the_sub_field('image');?>">
    

    For your thumbnail to show, you need to echo out the $thumb like this:

    
    <img src="<?php echo $thumb;?>">
    

    However, I have a feeling that your $thumb will not contain the correct value. Please make sure the return value for your field is set to ‘Image ID’ and that you are confident with the code examples on the image documentation.

    Thanks
    E