Support

Account

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>