marko krstić

Collections

Archives

ACF Pro condition if a repeater is empty

In this example, I have a hero slider ( ACF Pro repeater ) that is attached to all the pages and want to show slider only if at least one slide is created.

Note my repeater is "hero_slider". Yours can be different.

ACF Pro repeater with name hero_slider

Set up slider with Oxygen repeater component and assign condition.

Condition icon
  1. Press Condition button
  2. In the first block choose dynamic data from dropdown options
  3. In "Insert Dynamic Data" dialogue box scroll down to Advanced
  4. Press PHP Function Return value
  5. Important: in Function name type: "have_rows"
  6. Important: in Function Arguments: "hero_slider" (Type your repeater name)
  7. In the middle dropdown change from "==" to "is_not-blank"
  8. 3rd dropdown repeat speps 3 - 6

Function name: have_rows
Function argument: "repater name"

Let's Connect

Feel free to reach out for collaborations or just a friendly hello ?
[email protected]
linkedininstagramdribbblefacebook-official