Skip Navigation

[Resolved] Differen markers on same map

This support ticket is created 3 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 22 replies, has 2 voices.

Last updated by Shane 3 years, 3 months ago.

Assisted by: Shane.

Author
Posts
#2168201

Greetings,
I need to display two different icons (markers) on a map according to the category to which a custom post belongs.
How can i do this with toolset maps?

#2168293

Shane
Supporter

Languages: English (English )

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

Hello,

Thank you for getting in touch.

Are you setting up the view and map using the classic views or are you using the Block view with the gutenburg editor?

Please let me know and we can take it from there.

Thanks,
Shane

#2168309

Hi,
I'm using Gutenberg, thank you

#2168339

Shane
Supporter

Languages: English (English )

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

Hello,

Given that you're using the gutenburg editor, then it will be a little tricky to achieve.

Would it be possible for you to provide me with admin access to the site as well as a link to the page where the view is ?

Secondly let me know the taxonomies that you want the different markers to appear for.

From this I should be able to setup an example for you which you can modify later.

I've enabled the private fields for your next response.

Thanks,
Shane

#2170131

Shane
Supporter

Languages: English (English )

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

Hello,

So I've setup the template here below where you can see that i've added the conditional to check if the post has a specific taxonomy assigned.
hidden link

Secondly this happens only after the search is done because on the initial map page you aren't displaying the results. The problem is that we have to use the marker shortcodes to conditionally display the markers.

If you display the results on the first page then the markers will also get switched to the conditional ones.

Please let me know if this helps.
Thanks,
Shane

#2170183

ok,
i've seen that marker is now different by category (i change it in future with correct marker icon) if you can explain me where i must do it.

But there is 2 problem:
1) all icon now redirect to same post (hidden link)
2) i want if is possible to have also in first page all icon different by category, i use two maps only to exclude search results in llist in front page, then if there is any other method is good.

#2170279

Shane
Supporter

Languages: English (English )

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

Screenshot 2021-09-15 at 2.46.18 PM.png

Hello,

i've seen that marker is now different by category (i change it in future with correct marker icon) if you can explain me where i must do it.

The marker information is now constructed as a shortcode. Now if you look at the shortcode below you will see the marker_icon parameter. This is where you will pass the URL of the marker that you want to use.

<p>[wpv-map-marker map_id='map-11' marker_id='marker-[wpv-post-id]' marker_icon='//maps.sercomitalia.com/wp-content/plugins/toolset-maps/resources/images/markers/Hospital-1.png' marker_field='wpcf-indirizzo-completo']Ralu Logistika<br />Ugrinovci, Belgrade<br />Serbia</p>
<p><a href="[wpv-post-url]">Dettagli</a>[/wpv-map-marker]</p>
<p> </p>

Now you can just change the hospital-1.png to the filename of the other marker icons that are available. Here is a screenshot of the names of the other Icons.

1) all icon now redirect to same post (hidden link)

I've resolved this by change the code to use the post url so it should now be directed to the respective post.

2) i want if is possible to have also in first page all icon different by category, i use two maps only to exclude search results in llist in front page, then if there is any other method is good.

The markers would change if the view was listing out the items, however unless the view is listing out the posts then the markers will remain the default given that the results aren't there to manually pass the conditional markers to the map.

The only way to resolve this is to allow the results to be displayed without the view filter being triggered as yet.

Thanks,
Shane

#2171863

ok, i have fixed title and name on maps, but last question, i have ssen that i must edit code in editor mode, is right?

Tahn if i want to use 2 conditions, like a category and a "Stato Attività" to differ with more of 2 icon, how can i do it? i ned to nest conditional or can i use AND operator?

#2172043

Shane
Supporter

Languages: English (English )

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

Hello,

i have ssen that i must edit code in editor mode, is right?

That is correct. The code that you should edit is located at the link below.
hidden link

how can i do it? i ned to nest conditional or can i use AND operator?

For this if its to do a combination lets say if Post A meets X and Y condition then you can edit the conditional block and use the AND operator to add your other criterias.

Thanks,
Shane

#2172045

Thanks,ùplease can you tell me how to use AND operator in this?

<!-- wp:toolset-blocks/conditional {"conditions":{"operator":"AND","conditions":[{"firstArgument":{"source":{"label":"Post data","value":"post"},"value":{"source":"post-taxonomies","field":"category","customPost":null,"provider":"__current_post","is_repetitive":false,"is_created_by_types":false},"extra":""},"operator":{"label":"Contains","value":"contains"},"secondArgument":{"source":{"label":"Static value","value":"value"},"value":"CLIENTE","extra":""}}],"negative":false},"parsedConditions":" ( CONTAINS( #(category), 'CLIENTE' ) ) ","debug":true} -->
[wpv-conditional if=" ( CONTAINS( #(category), 'CLIENTE' ) ) " debug="true"]<!-- wp:freeform -->
<p>[wpv-map-marker map_id='map-11' marker_id='marker-[wpv-post-id]' marker_icon='//maps.sercomitalia.com/wp-content/uploads/2021/09/icon-green-c.png' marker_field='wpcf-indirizzo-completo'][wpv-post-title]<br>[wpv-post-field name="wpcf-citta"]<br>[wpv-post-field name="wpcf-stato"]</p>
<p>Dettagli[/wpv-map-marker]</p>
<p> </p>
<!-- /wp:freeform -->[/wpv-conditional]
<!-- /wp:toolset-blocks/conditional -->

#2172247

Shane
Supporter

Languages: English (English )

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

Hello,

Take a look at the screenshot.

You should see a plus icon, click the plus icon and you should be able add a new conditional. From there you should be able to setup your new conditional and see the option to set the conditional relationship to an AND or OR.

Please let me know if any further clarity is needed.

Thanks,
Shane

#2176075

Hi,
i don't see screenshot.

In my editor i don't see any plus icon, please can you help me?

#2176279

Shane
Supporter

Languages: English (English )

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

Screenshot 2021-09-22 at 9.16.06 AM.png

Hello,

See my screenshot where the icon can be found.

When you click on the conditional block you can select the edit conditional which will bring up this popup window from my screenshot.

This should allow you to modify the conditionals.

Thanks,
Shane

#2176385

ok, right, but if i use plus sign, and add a condition it tell me that is not correct, can you add an example to my page?

#2176387

Shane
Supporter

Languages: English (English )

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

Screenshot 2021-09-22 at 9.52.49 AM.png

Hello,

I've setup the example on your template as well as provided a screenshot of the full setup the conditional statement.

Please let me know if further clarification is needed.

Thanks,
Shane