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?
versteckter Link
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.
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
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