I am using repeater plugin with this code for simple gallery:
<?php if( have_rows('gallery') ): ?>
<ul class="slides">
<?php while( have_rows('gallery') ):
the_row();
// vars
$image = get_sub_field('slider_images');
?>
<li
class="slide">
<img src="<?php echo $image['url']; ?>" alt=""
/>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
And this is html output:
<ul class="slides"> <li class="slide"> <img alt="" src=""> </li>
</ul>
Apologies for messy code, this editor is behaving weirdly.
The image is empty, I have double checked and the sub_field “slider_images” is set to be Image URL.
I copied the code from documentation,
What is wrong?
If the field is set to ‘URL’ then just use:
<img src="<?php echo $image; ?>" alt="" />
or:
<img src="<?php the_sub_field('slider_images'); ?>" alt="" />
Your original code:
<img src="<?php echo $image['url']; ?>" alt="" />
refers to the ‘image object’ which your not using.