Published on August 3, 2020

Conditionally Output Elements if Nth Position inside a Repeater (ACF)

David Browne

When using Oxygen's repeater component with ACF repeater fields, sometimes we may not want to have every element appear in every row and may need them to be output conditionally depending on the row position.

There are a few reasons we may need to do this, some of these could be..

  • We have an alternating layout where certain elements are only displayed if the item is inside an odd or even row.
  • We have a layout where we want to display more content only on the first row inside the repeater.
  • We want to limit the number of rows that are shown (eg never show more than five items on this template)

In this members-only tutorial, we'll look at how we can use Oxygen's conditions feature inside of the repeater component to acheive this.

This is a premium members-only content.

To view the rest of the content, please sign up for membership ($47/month or $499 one-time).

Already a member? Log in below or here.

tagschevron-leftchevron-rightchainangle-rightangle-upangle-downfolder-omagnifiercrossmenuchevron-downarrow-right