Skip Navigation

[Resolved] Dynamic Map Markers Based On Taxonomy

This thread is resolved. Here is a description of the problem and solution.

Problem: On my Map View, I would like to display different marker icons depending on whether or not the post has a specific term from a custom taxonomy.

Solution: Use map marker shortcodes and conditional shortcodes with the has_term function to display different markers based on the has_term function.

Relevant Documentation:
https://toolset.com/forums/topic/different-map-markers-based-on-custom-taxonomy/

This support ticket is created 3 years, 8 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.

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)

This topic contains 17 replies, has 2 voices.

Last updated by Christian Cox 3 years, 8 months ago.

Assisted by: Christian Cox.

Author
Posts
#1996607

Just did as you explained, and am seeing the different markers now! Because I am still quite new to Toolset, having those visuals to reference were very helpful. Thank you so much for your time and help with this!

#1998025

Actually, one last thing:

Our old markers had clickable popups that showed some basic information... How do I go about adding those through the shortcode? For reference, this is what we previously had:

<h1>[types field='site-name'][/types]</h1>
<p>[types field='address'][/types]</p>
<p>Status: [wpv-post-taxonomy type='status' format='name']</p>
<p>Monitor Type: [wpv-post-taxonomy type='monitor-type' format='name']</p>
<p>Technician: [wpv-post-taxonomy type='technician' format='name']</p>

I have tried setting the "marker_title" property, but that isn't quite what we want, since it is not clickable. Thanks in advance!

- Dalton

#1998099

You can insert content in between the wpv-map-marker shortcodes to display it in the marker popup:

[wpv-map-marker...]
<h1>[types field='site-name'][/types]</h1>
<p>[types field='address'][/types]</p>
<p>Status: [wpv-post-taxonomy type='status' format='name']</p>
<p>Monitor Type: [wpv-post-taxonomy type='monitor-type' format='name']</p>
<p>Technician: [wpv-post-taxonomy type='technician' format='name']</p>
[/wpv-map-marker]