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; ?>
<ul>
<?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
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.