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; ?>
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.