Skip Navigation

[Resolved] Different marker images based on taxonomy

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

Problem:

The issue here is that the user wanted to use a different marker based on the Taxonomy of the post.

Solution:

This can be done by using our Conditional shortcode.

An example can be seen below.

[wpv-conditional if="(has_term('bemutatok', 'event_type', null) eq '1')"]
 
[wpv-map-marker map_id="map-3"  marker_icon="https://varadielet.ro/wp-content/uploads/2018/07/bemutato-pin.png" marker_id='marker-[wpv-post-id]-[wpv-attribute name="eid"]' marker_field="wpcf-lokacio" marker_title=" "][wpv-post-link id='[wpv-attribute name="eid"]']<br />Dátum: [convert_date post_field='evcal_srow' post_id='[wpv-attribute name="eid"]' marker_icon='[wpv-post-body view_template="event-marker-image"]']<br />Hely: [wpv-post-link][/wpv-map-marker]
[/wpv-conditional]

What is being down here is that you will need to have a different conditional for each taxonomy term and then switching the markers in each conditional.

Since has_term is a custom function you will need to add it to the views custom functions in Toolset->Settings->Frontend

This support ticket is created 6 years, 3 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 27 replies, has 2 voices.

Last updated by jozsefG 6 years, 3 months ago.

Assisted by: Shane.

Author
Posts
#1069394

I changed all the markers, they are now showing, but again, the standard pin...

#1069485

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jozsef,

Could you add the custom markers here hidden link

Then click on Maps.

Then try adding the markers again ?

Thanks,
Shane

#1069495

How to add the custom markers in Toolset Settings? The link goes there...

#1069498

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screen Shot 2018-07-31 at 2.10.41 PM.png

Hi Jozsef,

When you click on the link i provided, it takes you to the toolset settings page.

The next thing you need to do is to click Maps on the tabs and scroll until you see the Add new Marker Button. See Screenshot.

Please let me know if this helps.
Thanks,
Shane

#1069507

Added all the 7 pins. Unfortunately no help...

#1069564

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jozsef,

I looked again and it was that the marker_icon attribute was on the wrong shortcode.

It should now be working.

Thanks,
Shane

#1070272

Yes it is working now. Thank you Shane!

My last question: is it possible to set a default marker icon for spiderfy? I must use spiderfy because I'll have multiple events in the same place during the period the map shows the markers. You can see that now shows the sports category icon for both events on the lower part of the map.

#1071478

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jozsef,

Unfortunately not because spiderfy applies to the map itself and not to the individual markers.

Thanks,
Shane

#1071480

I've seen a method to change the marker for clusters with jquery. Isn't it possible to do the same with spiderfy too?

#1071483

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jozsef,

I see what you are referring to.

For the spiderfy i'm actually not sure if spiderfy has a method for this since we are using a custom API to add this functionality to our google maps.

Thanks,
Shane

#1071497

Please look after it if it's possible... Thank you.

#1071520

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jozsef,

I took a look at the API Documentation for this and was not able to find a way to do this.
hidden link

Thanks,
Shane

#1071533

Thanks a lot Shane for your help!!