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>
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).
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.