Skip Navigation

[Resuelto] different map markers

This support ticket is created hace 3 años, 10 meses. 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 5 respuestas, has 2 mensajes.

Last updated by stefanor-4 hace 3 años, 10 meses.

Assisted by: Minesh.

Autor
Mensajes
#1644353
Screenshot (30).png
Screenshot (31).png

Tell us what you are trying to do?
Trying to show different map markers depending on category

Is there any documentation that you are following?
https://toolset.com/forums/topic/different-custom-marker-in-a-map-based-on-a-custom-taxonomy/
https://toolset.com/forums/topic/different-marker-image-in-a-single-map/
https://toolset.com/forums/topic/help-show-multiple-markers-on-a-map/

Toolset is getting me crazy, I'm totally stuck with your map system, I have another ticket open with Luo since 2 months, but this problem is so simple and logic that is not natural all this code to solve.

I have a directory site, restaurants, hotels, apartments etc etc, I need to show a map with different markers depending on the item

Hotels red icon
Apartment green icon
Restaurant blue icon
ans so on

Simple, easy ...

Can you help ?

#1645781

Minesh
Supporter

Languages: Inglés (English )

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

Hello. Thank you for contacting the Toolset support.

Yes, sure. I am here to help and will try to help you in the right direction in order to resolve your issue.

Can you please share problem URL where you added your map as well as share access details.

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

#1646683

Minesh
Supporter

Languages: Inglés (English )

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

I need little more information. I see you are using the following view;
=> hidden link

The view is set to query two post types (appartments and Restaurantes).

I would like to know, you want to display different markder per post type or terms assigned. Because, you assigned different taxonomy to both post types.
- appartments have been assigned the appartmenet-category
- Restaurantes have been assigned the restaurante-type

I see with the restaurante-type taxonomy there are 17 terms, if you want to display different icons per term you need to add 17 conditional statements.
hidden link

So, as you can see I've adjusted the view's loop as you can see with your edit view link as given under:
=> hidden link

  [wpv-conditional if="( has_term('Beach', 'restaurante-type', null) eq 1)"]
          [wpv-map-marker map_id='map-47' marker_id='marker-[wpv-post-id]' marker_icon='//formentera.world/wp-content/uploads/2020/05/marker-hotel.png' marker_field='wpcf-address_details'][wpv-post-link][/wpv-map-marker]
          [/wpv-conditional]
[wpv-conditional if="( has_term('Beach Apartments', 'apartments-category', null) eq 1)"]
           [wpv-map-marker map_id='map-47' marker_id='marker-[wpv-post-id]' marker_field='wpcf-address_details' marker_icon='//formentera.world/wp-content/uploads/2020/05/marker-apartment.png'][wpv-post-link][/wpv-map-marker]
          [/wpv-conditional]

You can add as many conditional statements as per your requirement.

#1646685

Thank you Minesh
Following your question
I need one icon for apartments, one icon for restaurants, 1 icon for hotels, 1 icon for villas

I do not need a different icon for every term, just one for main category Restaurants

In my case, this code become ?
( has_term('Beach Apartments', 'apartments-category', null) eq 1)"]

#1646743

Minesh
Supporter

Languages: Inglés (English )

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

So, (appartments and Restaurantes) are post types NOT taxonomy.

To check the post type, you need to use the shortcode: [wpv-post-type]

For example:
[php]
<wpv-loop>
[wpv-conditional if="( '[wpv-post-type]' eq 'restaurante' )"]
[wpv-map-marker map_id='map-47' marker_id='marker-[wpv-post-id]' marker_icon='//formentera.world/wp-content/uploads/2020/05/marker-hotel.png' marker_field='wpcf-address_details'][wpv-post-link][/wpv-map-marker]
[/wpv-conditional]

[wpv-conditional if="( '[wpv-post-type]' eq 'apartment' )"]
[wpv-map-marker map_id='map-47' marker_id='marker-[wpv-post-id]' marker_field='wpcf-address_details' marker_icon='//formentera.world/wp-content/uploads/2020/05/marker-apartment.png'][wpv-post-link][/wpv-map-marker]
[/wpv-conditional]

</wpv-loop>
</code.

You can adjust the code and icon and add other conditional statements as per your requirement.

#1646919

My issue is resolved now. Thank you!

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