Skip Navigation

[Resolved] conditionally hide maps block

This support ticket is created 3 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 0.67 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#1711923

I have a maps block used in a content template which has a marker. the content template is for a singular post which has an address field. maps block dynamically puts a marker on the address in the field.

I want to conditionally hide the entire maps block if there is no address in the custom field. i.e. if there is no address listed for that post, I dont want to display the map because it will just display in the middle of nowhere

#1712001
Screen Shot 2020-07-19 at 5.40.30 PM.png

Hello, you can use a Toolset Conditional Block to accomplish this. Place a Conditional Block in your template, and add a condition to test whether the address field is not equal to a static, empty value. Then drag your Map Block into the Conditional Block contents to hide the Map block when the address field is blank. I'm attaching a screenshot here showing how to set up the condition to test for a blank value. My Field Group name is "Book Details" and the address field name is "Book Location". Let me know if you have trouble implementing this.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.