Skip Navigation

[Resolved] Display Toolset Map in Oxygen

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

Last updated by igorJ 3 years, 6 months ago.

Assisted by: Shane.

Author
Posts
#2272363

Tell us what you are trying to do?
Hello,

I've built sandbox wesbite on Gutenberg and Kadence Theme In Toolset I've created custom post types with location that is displayed with custom marker on the map (color of marker depends on chosen custom post type taxonomy).
Example on website below hero section:
hidden link

I wonder if displaying such a map is possible in Oxygen? If yes, how to do it? Is there any shortcode for this? How do I find it?
Kind regards,
Igor

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?

#2272501

Shane
Supporter

Languages: English (English )

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

Hi Igor,

Thank you for getting in touch.

In general you can find our maps shortcodes below.
https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/

These can be used to manually add Google Maps to your pages without the use of the Gutenburg editor and the Maps block.

To be more specific you will need to use the shortcode below to display the map.

[wpv-map-render map_id="my-map" map_width="400px" map_height="200px" fitbounds="off" general_zoom="6" single_zoom="15" cluster="on"]

Notice the use of the ID "my-map", this will be used to link the marker shortcode to the map.
For the marker you will need to use the following shortcode.

[wpv-map-marker map_id="my-map" marker_id="my-marker" marker_title="This is a marker" marker_field="wpcf-my-marker"]This is the content of the marker popup.[/wpv-map-marker]

Notice the map_id for the marker is the same as the map_id in the map render shortcode. Secondly the marker_field should contain the slug of your custom field keeping the "wpcf-" prefix.

Please let me know if this helps.

Thanks,
Shane

#2272999
toolset taxonomy.png
toolset job types.png
toolset field group.png
toolset dash.png

Hi,

hidden link
I was able to render map on my oxygen website by adding following shortcode to shortcode wrapper:

[wpv-map-render map_id="my-map" map_width="100vw" map_height="50vh" fitbounds="on" general_zoom="1" single_zoom="15" cluster="on" map_type="terrain"]

I have a problem with showing marker on the map. I've tried to add schortcode bellow to my shortcode wrapper:

[wpv-conditional if="(has_term('groundworks', 'job-type', null) eq '1')"]
[wpv-map-marker map_id="my-map" marker_icon="hidden link" marker_id="my-marker" marker_field="wpcf-adress"]
[/wpv-map-marker]
[/wpv-conditional]

Unfortunately I can't get it to display any marker on my map. Very similar code worked for map when displayed Views and Maps blocks. I've attached screenshots of my custom post types setup. Also I've used this tutorial to come up with shortcode.
https://toolset.com/forums/topic/different-map-marker-for-each-of-the-terms-within-a-taxonomy-on-map-view/

#2274137

Shane
Supporter

Languages: English (English )

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

Hi Igor,

The problem may perhaps be the conditional not being triggered for the marker to get added to the map.

Can you use this one instead and it should produce a debug result on the frontend.

[wpv-conditional if="(has_term('groundworks', 'job-type', null) eq '1')" debug='true']
[wpv-map-marker map_id="my-map" marker_icon="<em><u>hidden link</u></em>" marker_id="my-marker" marker_field="wpcf-adress"]
[/wpv-map-marker]
[/wpv-conditional]

Please let me know what the debug data is.

Also given than you're using the has_term() function you will need to declare it in the Third Party Custom Functions section at Toolset->Settings -> Frontend and scroll to Third Party Custom Functions and add the function name.

Looking forward to your response.

Thanks,
Shane

#2274415
has term.jpg
debug.jpg

Hi Shane, thanks for your reply. I did forget to register has_term function but after doing so I still can't see marker on the map. Please see attachments for debug and custom function.

Thanks,
Igor

#2274473

Shane
Supporter

Languages: English (English )

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

Hi Igor,

Based on the debug data this expression evaluates down to (0 = 1) where has_term is returning false. This means the taxonomy is not apart of the post being viewed so the marker's code won't show up.

If this is not true then please provide me with admin access to the site so that I can check on this further for you.

Thanks,
Shane

#2275357

Shane
Supporter

Languages: English (English )

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

Hi Igor,

Thank you for the login details.

I checked the page for you and what is happening is that you're checking if the current page has a specific term but this page doesn't even have a taxonomy assigned to it. Also there isn't any address on the page itself as well so no markers will be displaying.

Is it that you want to display the jobs on the homepage map ?

The easiest way to do this is to create a classic view and add the marker within that view. This view will provide the post data required for the markers to display.
If the classic view hasn't been enabled you can enable it by going to Toolset -> Settings and scrolling to Editing Experience. From there I recommend that you select " Show both the legacy and Blocks interface and let me choose which to use for each item I build".

This will allow you to have access to the classic editor as well as the block editor. From there refresh the page and go to Toolset -> Views.

From there you can use you conditional shortcode inside the views editor.

Once you've set things up in the view, you can add it to your template by using the view shortcode [wpv-view name='view-slug'] where you will replace view-slug with the actual slug of your view.

Please let me know if this helps.
Thanks,
Shane

#2275999

Hi Shane,
Thanks for checking my site and solving the problem! That's exactly what I wanted. I'm impressed with what toolset is able to do 🙂
I was even able to change clusters markers , thanks to this documentation:
https://toolset.com/documentation/programmer-reference/maps/customizing-cluster-markers-with-javascript-functions/
Level of customization and references you guys providing is crazy.
And last but not least. Your support, Shane. Thank you very much for helping me out,
Igor

#2276001

My issue is resolved now. Thank you!