I would like to create a page with a View (search + output) and a Map to display 3 differents makers:
- red marker for a custom post "school" with custom field active=True
- green marker for a custom post "school" with custom field active=False
- blue marker for custom post "homeschool"
My problem is that in the setting panel of the Map it's not possible to filter custom fields at marker level, the only option is to assign he marker to a secondary View (search + output).
Could you please tell if my understanding is correct and how I could achieve this ?
Hello. Thank you for contacting the Toolset support.
Using Toolset blocks - there is no feature available to display marker conditionally but there is a workaround that we can use the shortcodes or fields and text block and within that we can add the marker's shortcode to display the markers conditionally.
If you can share problem URL and admin access details I'm happy to share you workaround.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
As you can see with the following image: hidden link
I've added three conditions as per your requiremeht.
Now, what you should do it, click on the "Add Field or View" button and search for the marker and try to add the marker as per your requirement.
Please note that your map id is "map-5" and you should change the marker id to "marker-[wpv-post-id]" and set your desired image as per the conditional statement.
As you can see I've already done if for one of the conditional statement.
=> hidden link
Thanks, I think I understand the logic behind this workaround. Basically you removed the marker at the map level and created 3 markers (with conditional statements) at View loop level. But I notice that markers are not displayed anymore on the map. Is it because the conditional statement return no posts ? the condition seems correct to me, please see screenshots in attachment.
Also, could you explain how I can customize the marker icon with shortcode ? I can edit the Field and Text element, but what is the appropriate shortcode to customize marker icon ?
You can add attribute marker_title='my marker title' for marker hover.
And to customize the marker popup content you can add between marker shortcode. For exmaple:
[wpv-map-marker map_id='map-5' marker_title='my marker title' marker_id='marker-[wpv-post-id]' marker_field='wpcf-adresse-postale']
This is my marker POPUP content goes here
[/wpv-map-marker]