Support

Account

Home Forums Add-ons Repeater Field Echo current row number only.

Unread

Echo current row number only.

  • I want each row to begin with it’s row number, I’ve got this far below, but it echos the number of every single row at the start of each block of content.

    I just want the row number specific to that block of content to echo, so…

    0 [row0 content]
    1 [row1 content]
    2 [row2 content]
    etc…

    rather than…

    0 1 2 etc [row0 content]
    0 1 2 etc [row1 content]
    0 1 2 etc [row2 content]
    etc…

    <?php if( have_rows('images') ): $i = 0; ?>
    	<?php while( have_rows('images') ): the_row(); $i++; ?>
    			<h2>repeater <?php echo $i; ?></h2>
    	<?php endwhile; ?>
    <?php endif; ?>
Viewing 1 post (of 1 total)

The topic ‘Echo current row number only.’ is closed to new replies.