Support

Account

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

Solved

Repeater – skip first row

    • Nathan

    • September 9, 2013 at 4:27 pm

    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.

    • jarvis

    • September 9, 2013 at 11:13 pm

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

    • Elliot

    • September 10, 2013 at 12:49 pm

    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

    • Nathan

    • September 10, 2013 at 3:58 pm

    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; ?>
    • rdck

    • October 9, 2014 at 11:22 pm

     

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.