Support

Account

Home Forums Add-ons Repeater Field Changing the integer in a loop Reply To: Changing the integer in a loop

  • Hi @chrisfry

    Sounds like you need to use a counter variable to dynamicaly echo the row number. You can do this like so:

    <?php if(get_field('menu_item')): $i = 0; ?>
    <?php while(has_sub_field('menu_item')): $i++; ?>
    	
    	<div id="test-<?php echo $i; ?>">
    		
    	</div>
    	
    <?php endwhile; ?>
    <?php endif; ?>

    Note that the variable $i will increment each row, and you can render it with the echo function.

    Does that help?

    Cheers
    E