I am using ACF repeater plugin on my wordpress site to generate simple gallery. this si the code in my tempalte file:
<?php if( have_rows('gallery') ): ?>
<ul class="slides">
<?php while( have_rows('gallery') ): the_row();
// vars
$image = get_sub_field('gallery_images');
?>
<li class="slide">
<img src="<?php echo $image['url']; ?>" alt=""/>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
And this is html output on frontpage:
<ul class="slides">
<li class="slide"><img alt="" src="h"></li>
</ul>
The image src outputs “h”… I have double checked and the sub_field âslider_imagesâ is set to be Image URL.
I copied the code from documentation, didn’t change anything.
What am I missing?
If you’re outputting the URL from the ACF directly, I don’t think you need the
echo $image['url']
anymore.echo $image
will do.You should use
while(have_rows('gallery_images'))
andget_sub_field('url')
thenecho $image