Skip Navigation

[Resolved] How to show a map with advanced template editor

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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 3 replies, has 3 voices.

Last updated by Waqar 1 year, 4 months ago.

Assisted by: Waqar.

Author
Posts
#2638495

Tell us what you are trying to do?
I have a template that already show a map, based on lat and long data
I would like to change it to use the map-address data

This is the code of the lat-long imput. How to I edit it to use the map-address field?
My fields are:
Lat: latitude
Long: longitude
Maps addres: adresse-gps

<script type='text/javascript'>
jQuery(document).ready(function(){
var lat = [types field="latitude"][/types];
var long = [types field="longitude"][/types];
var title = '[wpv-post-title]';
jQuery('#js-map-element').attr('data-marker-title',title);
jQuery('#js-map-element').attr('data-marker-lat',lat);
jQuery('#js-map-element').attr('data-marker-lon',long);
});
</script>

Is there any documentation that you are following?
Most of the documentation show how to, but with the block editor, but I'm working with the advanced one.
https://toolset.com/forums/topic/adding-map-in-template-file/
https://toolset.com/forums/topic/how-to-add-a-map-to-a-layout-of-template/
https://toolset.com/course-lesson/displaying-a-simple-map/

What is the link to your site?
hidden link

#2639369

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

I'm not sure why you are using JavaScript, it's not necessary to display a map with marker, whether you are using the block editor or the legacy editor (where you use shortcodes to add the map and the markers).

If you need help creating maps with the legacy editor you can find the old documentation describing that here: https://toolset.com/documentation/legacy-features/maps-plugin/

Please review that, and if you still need help let us know.

#2639601

Hi Nigel,

The JavaScript is old code (from the really start of Toolset). It is related to custom lat / long field, that most of the 3000 post use. So I need to keep it.

But I succeeded to show a map with the map-gps address field, and with a conditional statement I either show the lat/long map or the gps map, depending on which information is available in the post.

So it works!

Thanks 😀

N.B. I can't close the ticket.. strange

#2639627

Hi,

Thanks for the update and glad that you were able to make it work.

I'm going to mark this ticket as resolved and you're welcome to start a new one, for each new question or concern.

regards,
Waqar