Hi,
I have created a map of a range of schools, which are members of the organization I am working for. It works fine, but I need to hide 3-5 of the schools on the map view, since they are abroad from Denmark, which makes the map zoom out immensely. I have created a checkbox in the post type: "Vis ikke på kort" (meaning "Don't show on map" in Danish) - how do i exclude these entries, without removing them entirely from the list?
See the page in question here: hidden link
All the best,
Mikkel from Denmark
Hello Mikkel and thank you for contacting the Toolset support.
Currently, with the Blocks editor, a map can get markers from a view. There is no way to exclude posts from the view's results inside the map.
But, I run a small test locally and I was able to exclude a post, using a conditional block, from the map. I used shortcodes to add the marker to the map instead of configuring the map block to pull markers from the view.
The trick is to add an empty map, without any markers. Check this screenshot hidden link
Then, inside the view's loop, I used a conditional block, you can set the condition on the checkbox field. Then, I add the marker to the map using a shortcode inside of a "Fields&Text" block. Check this screenshot hidden link
The map shortcode needs to use the map's ID. My map's ID is "map-4", and the address field has the slug "location", the shortcode is then:
[wpv-map-marker map_id='map-4' marker_id='marker-[wpv-post-id]' marker_field='wpcf-location'][/wpv-map-marker]
Notice how I used the map's ID in map_id='map-4' and I prefixed the field slug with "wpcf-" in marker_field='wpcf-location'.
Read more about the Toolset Maps shortcodes here https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#wpv-map-marker
Does it make sense? Let me know if you have any questions.