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
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.