Home Forums Add-ons Repeater Field Unique ID for Repeater Field Reply To: Unique ID for Repeater Field

  • Hi @Krissy S.

    No worries, here is the example from the docs with some extra PHP to create a counter:

    <?php if(get_field('repeater_field_name')): $i = 0; ?>
    	<?php while(has_sub_field('repeater_field_name')): $i++; ?>
    		<li class="section-<?php echo $i; ?>">
    			sub_field_1 = <?php the_sub_field('sub_field_1'); ?>, sub_field_2 = <?php the_sub_field('sub_field_2'); ?>, etc
    	<?php endwhile; ?>
    <?php endif; ?>