How to Use ACF Fields with Conditional Display


You can use ACF Fields with Stackable’s Conditional Display, and hide or show blocks depending on the value of your ACF Field.

If for example you would like a block to show only if that Custom Post Type contains a value for a specific ACF field, all you need to do is select the block, navigate to the Advanced tab in the inspector, and then open the Conditional Display panel. From there, choose Show on Condition Match for the Visibility, and then choose Custom PHP for the Condition Type, Afterwards, just add this code: 

get_post_field( 'linkedin_url', $get_the_ID ) !== ""

Alternatively, you can also do this by adding this code: 

get_post_meta( get_the_ID(), 'field_63b542618564d', true ) !== false<br>

For the second code, you will need to get the Field Key.

To get the Field Key, in the Custom Fields section in your WordPress dashboard, navigate to Field Groups, and then edit the specific field.

By default, in ACF, the Field Key is hidden from view. To show it, click on Screen Options and then tick the box of Field Keys.

This is one way you can use ACF Fields with Stackable’s Conditional Display. 🎉