Conditional content upon True/False ACF field

Hi, team.

I have a site dedicated to online scam samples.
It has ACF for informational fields about the cases I publish.
Some cases are reiterative.

For the latter, there’s a true/false field that rules “second detection” (containing a literal preformatted text field and a screenshot image).
If false, fields don’t even show in the backend. I need to get the same from cornerstone.

Since I show all cases with the same single layout, I want to show a “2nd detection” zone IF there is such data.
As there is no looper, I can’t make use of provider output empty; thus I thought of the true/false.

Question: can I get to show/hide the 2ndary detection container depending on the true/false state?
Is this overthinking and there’s a straight way?

I have this same need in multiple projects, with different aspects, so this lesson will be very useful.

Thank you!

Hello Ricard,

Thanks for posting in!

You can use a String condition like {{dc:acf:post_field field="my_field"}} IS TRUE OR
Use a Number condition {{dc:acf:post_field field="my_field"}} == 1 depending on the return value of the ACF field.

Hope this helps.

Hi Rue,

I used {{dc:acf:post_field field="my_field"}} IS TRUE but it did not deliver.
After trying some variants, I found this one to be functional:
{{dc:acf:post_field field="my_field"}} IS 1 which I guess versions your 2nd option.

This is the Public Case if I didn’t explain the use case well enough. Most cases have 1 “detection”, this pilot case has a 2nd.

This was a solution, thank you very much!

You are most welcome, Ricard.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.