Conditionally Hide Content Based on Custom Field Value

I created an ACF checkbox custom field for my custom post type called Programs. I’d like to be able to conditionally hide or show columns on my Looper based on which field(s) were selected.

The checkbox is called Program Availability and there are 2 options Summer Programs or After School Programs.


What I’d like to do is display content on my looper only in the event that a specific value is given within the checkbox.

For example, when the checkbox Program Availability has the value Summer Programs, I’d like column 1 to be visible. And when the checkbox Program Availability has the value After School Programs I’d like column 2 to be visible.

What conditions do I have to set in order to make either of those columns visible based on the checkbox selection?

Hi @santosfel5,

Thanks for reaching out!

Would you mind sharing your credentials so that we can check your setup properly? To do that, please give us the following information in a Secure Note.

  • WordPress Login URL
  • Admin level username and password
  • Page of the URL where the looper is located or Layout Builder name

You can find the Secure Note button at the bottom of your posts.

Thank you.

Hi @Marc I’ve added the secure note. The page I’m working on with the looper is called Our Programs.

Hi @santosfel5,

You need to add the condition {{dc:acf:post_field field="availability"}} with Summer Programs for the Column 1 and with After School Programs for Column 2. I have added the same to the test page and you can check and replicate it on your page.

Thanks

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