Support

Account

Home Forums Add-ons Repeater Field Repeater inside group error

Helping

Repeater inside group error

  • Hi there,
    I have a group and inside the group I have a repeater with image (Field name “icon”, type “Image” and Return format “Image Array”). I have repeaters inside groups on other parts of the website where I’m able to echo out the images just as expected, but here I can’t get it to work.

    What is wrong?

    <?php if( have_rows('unique_selling_points') ): ?>
    	<?php while( have_rows('unique_selling_points') ): the_row(); 
    	?>
            <section class="part green">
    			<div class="wrap">
    					<div class="flex-wrap c-4">
    						<?php if( have_rows('usp') ): ?>
    							<?php while( have_rows('usp') ): the_row(); 
    							$usp = get_sub_field('icon');
    							?>
    								<div class="item icon">
    									<?php if ($usp) { ?>
    									<img src="<?php echo esc_url( $usp['url'] ); ?>" alt="<?php echo esc_attr( $usp['alt'] ); ?>" class="icon" />
    									<?php } ?>
    								</div>	
    						    <?php endwhile; ?>
    						<?php endif; ?>
    					</div>
    			</div>
            </section>
        <?php endwhile; ?>
    <?php endif; ?>

    The error I’m getting:
    Warning: Trying to access array offset on value of type int in […] on line […]

    Any suggestions? 🙂

    Many thanks in advance!

  • What is the return value of the image field set to?

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.