Home › Toolset Professional Support › [Resolved] Hide map if no results in search
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.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | - |
- | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | - |
Supporter timezone: Asia/Karachi (GMT+05:00)
Tagged: Custom search, Toolset Blocks, Toolset Maps, Views, Views plugin
Related documentation:
This topic contains 6 replies, has 3 voices.
Last updated by bxbM 3 years, 9 months ago.
Assisted by: Waqar.
Tell us what you are trying to do?
Hide map if no results in search. I would like the search results to just say "No companies found" or at least hide the map so it doesn't show Lat0 and Long0 when the search results are empty
Is there any documentation that you are following?
Is there a similar example that we can see?
What is the link to your site?
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Hi there
Are you using the blocks interface and View and Map blocks to create this custom search, or the legacy interface?
It is possible to set a default centre for the map when there are no markers to display (because there are no search results), but it is not obvious how you can do that (we have an internal ticket to improve that UI).
Assuming you are using Blocks, in the settings for the Map block
- turn off the setting Adjust zoom and center to show all markers at once
- that will expose settings to manually set the latitude and longitude (plus zoom level) of the map. These will be used when there are no markers, so set them to sensible values
- turn the setting Adjust zoom and center to show all markers at once back on
{ticket status updated}
When attempting to change settings on map block I get this error message, but the map block is not inside the view block. No settings appear in the sidebar.
Thanks for sharing the screenshot and it is strange that you're seeing that message.
Can you please share temporary admin login details so that I can see how this view is set up?
Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.
Thank you for sharing these details.
If you'll check the block structure of your "Search HVAC Pros" page, you'll see that the "Maps" block is indeed placed within the "Views" block, which is why you're seeing the error message.
( screenshot: hidden link )
To change the Map block's settings, you'll need to temporarily drag it out of the "Views" block and adjust the settings as needed. After that, you can move it back to the position you'd like it to appear.
For hiding the map, when no results are returned by the view, you can place the following CSS code, below the view's "No Items Found Text".
( screenshot: hidden link )
<style>.wpv-view-output .wpv-addon-maps-render {display: none;}</style>
My issue is resolved now. Thank you!