How to set a looper condition on a ACF checkbox within a repeater

Hi Guys,

I’m struggling to hide/show images based on the the content of a checkbox within a repeater

here is what it looks like on the front end… what I want is the food type (gluten free etc) to show the relevant image when the checkbox is ticked

any help welcomed! and thank you

Figured it out!

Diary-free IN {{dc:looper:field key=“food-type”}}

Nice! Glad you got it working. Thanks for letting us know. Definitely a tricky one since it’s hard to know how exactly ACF is outputting that checkbox field.

Hey @alexander

in this case you can set the value in acf to either a value per checkbox or to the label. I had set the output to be the label, hence a string check for the label within the field seems to have worked

Its a learning curve but I’m loving all things looper, esp the ability of conditions

Makes sense! It’s been really fun for us to see all the ways people are using things like Loopers and Element Conditions. So many use cases we’d never have thought of ourselves. Glad to hear how much you’re enjoying them.

I’m loving them!

I’ve got an idea to update an old (pro) website to have a CPT for the committee members, and then have a looper pull through active committee member’s profile in a coherent designed way, rather than the client have to delve into editing pro

Your clients will love you for it! I saw someone use ACF Options page to create a centralized place for several site wide things like contact info. It even had a way for the client to enable/disable a sitewide banner and set whatever content they wanted inside it. ACF is really a great way to give clients more access without risking them breaking the design of the site and without them having to learn how to use the builders.

1 Like