Conditionally show content based on Dynamic Content (ACF) value?

I would like to show something based on the value of a boolean in ACF. Is there a way I can check for the ACF content and display a string if it is true? Is that possible in X theme?

Hello @jrhager84,

Thanks for posting in! Yes, it is possible. You can use the DIV element as the wrapper of your content and then in your DIV element settings, you can use the String condition and insert the ACF dynamic content in the filed provided:

Hope this makes sense.

So is it a simple show/hide situation? Or can you specify text based on the value of the boolean?

Hello @jrhager84,

If the screenshot above has this condition added in the DIV element and its true, then the DIV element will display:

  • If ACF field “my_field” value is equal to “your string”, DIV element will display
  • If ACF field “my_field” value is NOT equal to “your string”, DIV element will NOT display

Hope this makes sense.

I see. So in order to have different values, I’d just have two elements that have each state in it, correct?

Hello @jrhager84,

If your field has different values, then you will have to have sets of DIV element like this:

And then you will have conditions on each of the DIV element.

For DIV element 1:

  • If ACF field “my_field” value is equal to “String 1”, DIV element 1 will display

For DIV element 2:

Hope this helps.

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