Conditional: Hide Div If Custom Field Is Empty

With the new Conditions Builder how would you hide a Div if a custom field is empty.

I’m using acf for custom fields and have a Parent div with two child div’s. One has static text and the other has dynamic text pulling from a custom field (location-phone). If the location-phone field is not empty the entire div should display. If empty the entire div should not show.

I attached a photo of what I’ve tried but its not working. Any thoughts or ideas.

bricks-condition-2

1 Like

As @thomas said: This is just the beginning. I’m pretty sure that the conditions functionality will get much more features in the near future.

Solution: Field != (quite literally leave empty)

11 Likes

Thanks for taking the time to help figure this out.

1 Like

Yes.
This is the same condition I am using for my site too, and it works.

So Simple. Just tried it and it works. I was scratching my head about this for ages! Thanks

Is there any way we can hide a container if a post widget is empty?

Basically if the metaquery is empty and so the post widget I want to hide the whole container.

The metaquery shows posts that share in comun a specific custom field value.

I hope this condition helps.

Choose the container and set the condition based on this setting.
image

1 Like

Hi Jornes, thanks!

In this case I’m using the post widget to check if two different post types share a specific ACF value in commun. I do all that with the meta query option but if I don’t get any results I would like to hide the container that includes those related posts (the container with the title, description and post widget).

I’m doing that with a small helper function but it would be nice to hide something if a specific widget is blank.

Thanks! How is it possible to hide the heading if a JetEngine listing grid has no items?

1 Like

Vote it there!

It is more useful than it seems

I have a DIV containing a header and values from a checkbox CPT created with JetEngine. I wanted to hide the DIV when there are no checkboxes selected in the post. Following the above instructions from this thread did not work for me. The DIV was not hiding even though no checkbox results were showing on the front end.

Reached out to support and Charaf suggested that since a value is outputted as ‘false’ when no checkboxes are selected, you need to type ‘false’ in the conditions section as shown in the screenshot.

If you have 5 checkboxes in your CPT, you will need to type false 5 times. e.g. false, false, false, false, false. If you have 10 checkboxes then you need to type false 10 times and so on.

This works when it comes to hiding elements that contain checkbox values.

Did you find how to do it?