ACF Custom Field Condition Visibility Not Working

I’m the original poster of this post: Conditionally Hide Content Based on Custom Field Value

It looks like the thread has been locked, so I’ll continue here.

I’ve completed what @tristup recommended, but it is not working both in my example and in his that he provided. If more than one Program Availability box is checked for a program than no columns will display. If only one item is checked, than a column will display.

Program with one checkbox selected:

It displays the column containing the icon for Summer Programs correctly:

Now if a program has more than one checkbox selected under Program Availability:

Then it displays no columns that contain the program icons:

It should be displayed like this:

Hi @santosfel5,

I would suggest you go through the following thread which explains how you can get the value from the checkbox of the ACF.


https://theme.co/forum/t/acf-options-field-array-single-value/86816

Hope it helps.
Thanks

Hi @tristup I don’t need to output the ACF field value. What I’m looking to do is conditionally show and hide columns if the current post has an ACF checkbox checked.

For example, if the Summer Programs checkbox is checked then the column containing the Summer Programs will conditionally be visible. I’ve got it to work that way so far.

The problem is if (2) checkboxes are checked, let’s say Summer Programs and After School Programs, then no columns will appear.


I’m guessing what’s happening is that when the ACF field has more than one checkbox checked, its looking for those two values in order for the conditions to be met. There needs to be an OR condition looking for those two values. How can I add an OR condition where the ‘availability’ ACF field value is equal to both Summer Programs and After School Programs?

Would it look something like this?

Hello @santosfel5,

We would love to check your element condition settings and how the ACF fields were set up. Please provide us access to the site. You can create a secure note in your next reply with the following info:
– Link to your site
– WP login URL
– WP username
– WP password
– WP Administrator Role
- Confirmation that we can access and make changes to your site

To know how to create a secure note, please check this out: How The Forum Works

Best Regards.

I’ve added the secure note. The page is called Our Programs which has the programs in the looper.

Hello @santosfel5,

Since the field will return an Array, please switch your condition into like this:

Kindly let us know how it goes.

1 Like

@ruenel I will check to see if this worked.

Hello @santosfel5,

Please let us know how it works

Thanks

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