Hello!
I have a question regarding repeater fields.
So I have a repeater with 2 subfields — Featured Image and Additional Image.
I have 2 rows of items. The 1st row has both the featured image and additional image — but the 2nd row only has the additional image.
Screenshot for reference: https://imgur.com/a/gkxVmnJ
I can get the second additional image to display — but since I left the featured image empty in the 2nd row, I’m getting a blank image.
Currently my php is set up like this:
<?php if(have_rows(‘large_image_layout’)) { ?>
<?php while(have_rows(‘large_image_layout’)) {
the_row();
$featured_image = get_sub_field(‘featured_image’);
?>
<?php } ?>
<?php } ?>
<div class=”featured-image” style=”background-image:url(<?php echo $featured_image; ?>);”></div>
How would I go about only getting the item from the first row? Or check if the row is empty, return the last item or first row item?
Thanks so much!