Description
Adds helper functions for retrieving the total count of repeater rows, and the index of an individual repeater row.
The block_row_index() function should be used inside a repeater loop (after the block_row() call). This returns the index of the current row.
block_row_index()
Parameters
- none
Usage
if ( block_rows( 'repeater' ) && block_row_count( 'repeater' ) > 3 ):
while ( block_rows( 'repeater' ) ) :
block_row( 'repeater' );
// Note: The index is zero-based, so we should add 1 to get a non-programmer count.
echo '<li>This is row number ' . block_row_index() + 1 . '</li>';
endwhile;
echo '</ul>';
endif;
