Support

Account

Home Forums Add-ons Repeater Field Repeater – skip first row

Solved

Repeater – skip first row

  • In the documentation, there is an example on how to only show the first row of a repeater. Is there a way of showing all except the first row (or a specified number of rows)?

    I’m using a repeater with a series of images, and want to use the image from the first row as a hero image (using the example in the docs), then show some other content, and then display the second and following images from the repeater after that.

    Cheers.

  • Hi,
    Could you not add a count to the loop and then start from greater than 1?

  • Hi @nathan

    All you need to do is revers the logic – so instead of testing the $i for a value of 1, test it for a value not of 1 (!=).

    Good luck

    Cheers
    E

  • Thanks guys!

    Ended up using

    <?php if(get_field('slides')): $i = 0; while(has_sub_field('slides')): $i++; if ($i != 1): ?>
    Blah Blah Blah
    <?php endif; endwhile; endif; ?>
Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Repeater – skip first row’ is closed to new replies.