May 06, 2020
Need to add varied styles to rows, but don’t want to program it in the backend? Or add ID numbers to rows in order to setup toggles?
ACF Repeater works with get_row_index() to count the number of rows present.
Check out this example using a counter to add a clear every second row:
if( have_rows() ): while( have_rows() ): the_row();
$count = get_row_index();
// repeater content
if ($count % 2 == 0) { echo '<div class="clear"></div>'; }
endwhile; endif;