- It may be important to determine the row number of a Repeater or Flexible Content field (index).
- His function accomplishes this without the requirement for a special $i++ counter.
- Returns the current row index within a
have_rows()loop.
Method :
This example demonstrates how to use this function to output unique ID’s into each row’s wrapper. This is useful for CSS / JS customization.
<div class="accordion" id="accordion-<?php echo get_row_index(); ?>">
output shows (on inspecting):
