Home › Forums › Add-ons › Repeater Field › Unique ID for Repeater Field › Reply To: Unique ID for Repeater Field
I am trying your method but it is outputting the same unique ID per repeater row and not a unique ID ?
<div class="accordian">
<?php
$uniqueid = uniqid('question');
$count = 0;
while ( have_rows( 'layout_nine_questions' ) ) : the_row(); ?>
<div class="accordian_single">
<input type="checkbox" id="<?php echo esc_attr( $uniqueid ); ?>">
<label class="accordian-label" for="<?php echo esc_attr( $uniqueid ); ?>"><?php the_sub_field( 'layout_nine_question' ); ?></label>
<div class="accordian-content">
<?php the_sub_field( 'layout_nine_answer' ); ?>
</div>
</div>
<?php $count ++; ?>
<?php endwhile; ?>
<?php else : ?>
<?php // no rows found ?>
<?php endif; ?>
</div>
</div>
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.