ACF Conditionally Display Field

Hi,

I have two custom fields created with ACF Pro. I am successfully displaying them in the Post Layout using dynamic data. However, is there a way to conditionally not display one of the fields, depending upon the value of the other?

This is the output I am using on the post layout:

{{dc:post:meta key="Available"}} - £{{dc:post:meta key="price"}}

In the first half of this there are two options - “Available” and “Sold”.

If “Sold” is chosen I do not want to disply the price. Is it possible to do this?

Many thanks,
Christopher

Hi @cdnwhite,

You could use Expression based Element Conditions to do this. You would need to create two elements - one for each potential output - then add a condition to each. Those conditions can check for the presence of data in the ACF fields (see the linked article for more info).

Hi @alexander,

That will do exacly what I need.

Thank you,
Christopher

Ok great! You’re most welcome.

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