Skip Navigation

[Resolved] Different Map Markers Per post Type

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

Problem:

Display different map marker icon on post type.

Solution:

You can try [wpv-conditional] shortcode, like this:

https://toolset.com/forums/topic/different-map-markers-per-category/#post-2343707

Relevant Documentation:

https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#wpv-map-marker

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/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by michaelB-49 2 years ago.

Assisted by: Luo Yang.

Author
Posts
#2339227

Tell us what you are trying to do?
Hi, I'm trying to use different map markers per category on this page right here:
hidden link

One is a PARK, one is a RESTAURANT.

Is there any documentation that you are following?
I've been trying to follow this, but not having any success:
https://toolset.com/forums/topic/different-map-markers/

Is there a similar example that we can see?
Yes, basically the same as what the ticket above was looking at.

What is the link to your site?
hidden link

Thank you!!!

#2339341

Hello,

Please provide a test site with the same problem, fill below private message box with test site credentials, also point out the problem page URL, I can setup a demo for you.

#2343707

I have done below modifications in your website:
Edit the problem page:
hidden link

1) find and select map block, in block setting panel, remove the marker setting, you can use below shortcode block to display the map markers

2) Find and select view block, add a shortcode block in view's loop, with below codes:

[wpv-conditional if="( '[wpv-post-type]' eq 'restaurant')"]
[wpv-map-marker map_id='Dallas-Fort-Worth-Map' marker_id='marker-[wpv-post-id]' marker_icon='//adventureswithmydog.com/wp-content/plugins/toolset-maps/resources/images/markers/Home.png' marker_field='wpcf-location-address'][wpv-post-link][/wpv-map-marker]
[/wpv-conditional]
[wpv-conditional if="( '[wpv-post-type]' eq 'park')"]
[wpv-map-marker map_id='Dallas-Fort-Worth-Map' marker_id='marker-[wpv-post-id]' marker_field='wpcf-location-address' marker_icon='//adventureswithmydog.com/wp-content/plugins/toolset-maps/resources/images/markers/Shop-2.png'][wpv-post-link][/wpv-map-marker]
[/wpv-conditional]

Above codes with check current post's post type value, and display different marker icon, you can change the "marker_icon" attribute value to other icon image URLs

More help:
https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#wpv-map-marker

#2344703

All set and now have the code sample to use going forward too! Thanks Luo!!!!

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