Skip Navigation

[Gelöst] Different map marker pins per category

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem:
Different map marker pins per category

Solution:
User was passing wrong value to "marker_icon" attribute, You should just pass your desired marker icon URL instead of adding image tag.

You can find the proposed solution in this case with the following reply:
=> https://toolset.com/forums/topic/different-map-marker-pins-per-category/#post-2037495

Relevant Documentation:

This support ticket is created vor 2 Jahre, 11 Monate. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 3 Antworten, has 2 Stimmen.

Last updated by Stephen Vaughan vor 2 Jahre, 11 Monate.

Assisted by: Minesh.

Author
Artikel
#2036659
Screenshot 2021-04-29 at 11.37.56.png
Screenshot 2021-04-29 at 11.37.24.png

Tell us what you are trying to do?

I have a directory site that I am working on. It will list bike friendly hostelries and cycling routes.
So far I have the view set up to show all the hostelries and the map with pins above it. All food. In the list each location has small plaque icons to indicate what they are and the services provided. I implemented this via a category taxonomy with a custom image field and then used the post-taxonomy-iterator which I have just discovered. (See screenshot of map and listings.)

The next task is to set pins with my own custom artwork. (See the pins I have loaded into the Media Library.)
For this specific purpose I went for a separate Map Pins category and again added a custom image field to associate the correct pin image. This taxonomy uses the following terms:

• hotel-pin
• b-b-pin (B&B)
• hostel-pin
• campsite-pin
• restaurant-pin
• cafe-pin
• public-house-pin
• bike-services-pin

Is there any documentation that you are following?

So far I have been looking at this support ticket to see if I can decipher a solution:

https://toolset.com/forums/topic/adding-different-marker-image-on-a-single-map-using-taxonomies/

I have set up the has_term() function in Settings > Front-end Content

Is there a similar example that we can see?

Here is what I have tried so far. From the following the code does set out the map according to all the pin types specified but doesn't seem to render the maps; it shows spidered groupings but when you click in no pins:

//Starting to work but no map pins

[wpv-conditional if="(has_term('hotel-pin', 'map-pin', null) eq '1')"]
[wpv-map-marker map_id="map-1" marker_id="marker-1" marker_icon="<img src='hidden link;" marker_field="wpcf-address"][/wpv-map-marker]
[/wpv-conditional]

[wpv-conditional if="(has_term('b-b-pin', 'map-pin', null) eq '1')"]
[wpv-map-marker map_id="map-1" marker_id="marker-1" marker_icon="<img src='hidden link;" marker_field="wpcf-address"][/wpv-map-marker]
[/wpv-conditional]

[wpv-conditional if="(has_term('hostel-pin', 'map-pin', null) eq '1')"]
[wpv-map-marker map_id="map-1" marker_id="marker-1" marker_icon="<img src='hidden link;" marker_field="wpcf-address"][/wpv-map-marker]
[/wpv-conditional]

[wpv-conditional if="(has_term('campsite-pin', 'map-pin', null) eq '1')"]
[wpv-map-marker map_id="map-1" marker_id="marker-1" marker_icon="<img src='hidden link;" marker_field="wpcf-address"][/wpv-map-marker]
[/wpv-conditional]

[wpv-conditional if="(has_term('restaurant-pin', 'map-pin', null) eq '1')"]
[wpv-map-marker map_id="map-1" marker_id="marker-1" marker_icon="<img src='hidden link;" marker_field="wpcf-address"][/wpv-map-marker]
[/wpv-conditional]

[wpv-conditional if="(has_term('cafe-pin, 'map-pin', null) eq '1')"]
[wpv-map-marker map_id="map-1" marker_id="marker-1" marker_icon="<img src='hidden link;" marker_field="wpcf-address"][/wpv-map-marker]
[/wpv-conditional]

[wpv-conditional if="(has_term('public-house-pin', 'map-pin', null) eq '1')"]
[wpv-map-marker map_id="map-1" marker_id="marker-1" marker_icon="<img src='hidden link;" marker_field="wpcf-address"][/wpv-map-marker]
[/wpv-conditional]

[wpv-conditional if="(has_term('bike-services-pin', 'map-pin', null) eq '1')"]
[wpv-map-marker map_id="map-1" marker_id="marker-1" marker_icon="<img src='hidden link;" marker_field="wpcf-address"][/wpv-map-marker]
[/wpv-conditional]

I tried the following variations but these didn't improve matters:

[wpv-conditional if="(has_term('hotel-pin', 'map-pin', null) eq '1')"]
[wpv-map-marker map_id="map-1" marker_id="marker-1" marker_icon="<u>hidden link;" marker_field="wpcf-address"][/wpv-map-marker]
[/wpv-conditional]

[wpv-conditional if="(has_term('hotel-pin', 'map-pin', null) eq '1')"]
[wpv-map-marker map_id="map-1" marker_id="marker-1" marker_icon="<u><img srcc='hidden link;" marker_field="wpcf-address"][/wpv-map-marker]
[/wpv-conditional]

As a matter of interest would using post-taxonomy-iterator in some way be able to do what I want?

What is the link to your site?

Site is under construction and behind maintenance page but I can grant temporary admin access if we can't find a quick solution.

#2037399

Minesh
Supporter

Languages: Englisch (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please share problem URL where you are trying to display different map markers per taxonomy term as well as admin access details and tell me what exactly not working and i'm happy to review and fix the issue.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) 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.

#2037495

Minesh
Supporter

Languages: Englisch (English )

Timezone: Asia/Kolkata (GMT+05:30)

I see you added the map marker as given under:

[wpv-map-marker map_id="map-1" marker_id="marker-1" marker_icon="<img src='<em><u>hidden link</u></em>;" marker_field="wpcf-address"][/wpv-map-marker]

Where you setup the "marker_icon" with the image tag.

You should just pass your desired marker icon URL instead of adding image tag.

So for example:

[wpv-map-marker map_id="map-1" marker_id="marker-1" marker_icon="<em><u>hidden link</u></em>" marker_field="wpcf-address"][/wpv-map-marker]

As you can see i just passed the URL to marker_icon attribute:

marker_icon="<em><u>hidden link</u></em>"

Can you please make that change and see if that help you to resolve your issue.

#2037499

That's It!

Thanks Minesh. I see it working now. I notice that I passed tho same Hotel pin image to all the conditionals in my code so I guess I must have become a bit cross eyed in the process.

I have one or two other map related questions so I will open separate tickets for these. I'll keep the staging live while I step throw these.

Thanks again.

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