QUESTION - Customize > Conditions to display element only if an ACF term "is set"

Hey there! I’m working on converting a PHP template to utilize Pro’s LAYOUT feature. In PHP I check if a field is filled in for pretty much every dynamic field in the CPT. I was wondering if it’s possible to use Pro’s conditions to do this same kind of check?

Currently, I have "conditions > Expression (string). But it only allows me: is, is not, in, not in as my options. I wish there was an option for “is set, is not set”.
image

In PHP I always do this:
if(get_field(‘field_name’) !== ‘’) : // Display element
// or
if(get_field(‘field_name’)) : // Display element

Any ideas on how to make this work?

Hello @mattmintun,

Thanks for writing to us.

You need to select the Number from the condition select box then you will be able to set the expressions and set the condition you want. Please have a look at the given screenshot below.

Front-Page-Content-X

Please have a look at our doc to learn more about how to use condition and assignment operator

Thanks

Thanks! but that unfortunately didn’t work.

Here’s the condition on this element:
image

Here’s the custom field in this specific CPT (it’s filled in with a value):

However, this element does not display on the front end (you would see “class schedule” in between “buy” and “contact us”):
image

Hi @mattmintun,

You can use the String condition {{dc:acf:post_field field=“custom-field”}} is not “”.

image

Hope that helps.

Thank you.

Thanks @marc_a. I was hoping this would work (and I feel like it should have!) but it didn’t. This test is on a column.

Here’s my Conditions:
image

You can even see in the selector it shows this field not having a value:
image

Here’s the field this is reflecting:
image

And you can see the column still showing up on the front end (the red marked one should not be showing up):

Hi @mattmintun,

Sorry for the confusion, please remove the "" on the second field. I tried again on my test server and it is now working.

image

If it still doesn’t work on your end, would you mind sharing your admin credential 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

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

Thank you.

That did it! Thank you!!

Hi @mattmintun ,

You’re welcome! If you have any other concerns or clarifications regarding our theme features, feel free to open up a new thread.

Thank you.

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