This is the shortcode per the map (a snippet)
[leaflet-map]
[leaflet-extramarker lat=44.07375280310988 lng=11.689234549893753 icon=fa-utensils prefix=fa iconColor=white title=agriturismo-badia-della-valle color=red]Agriturismo Badia della Valle[/leaflet-extramarker]
And this is the code i used for targetlink
[targetlink title=agriturismo-badia-della-valle linktext="Agriturismo Badia della Valle" map=0]
As you can see i added a parameter to specify the map i’m referring to (0 to n in the order of being added to the page). I have modified the source code to handle the new parameter, but it’s a hack.
targetmarker.js (i changed this function adding the check for the map parameter)
// targetmarker same site - search with title
function leafext_target_same_title_js(mapID, title, target, zoom, debug) {
console.log("leafext_target_same_title_js", title, target, zoom, debug);
window.WPLeafletMapPlugin = window.WPLeafletMapPlugin || [];
window.WPLeafletMapPlugin.push(
function () {
var map;
if (mapID === '') {
map = window.WPLeafletMapPlugin.getCurrentMap();
} else {
map = window.WPLeafletMapPlugin.maps[mapID];
}
leafext_target_marker_title_do(map, title, target, zoom, debug);
}
);
}
targetmarker.php (i added the map parameter in the handleing of the shortcode and creation of the link)
...
$options = shortcode_atts(
array(
'lat' => '',
'lng' => '',
'property' => '',
'value' => '',
'title' => '',
'link' => '',
'linktext' => 'Target',
'popup' => 'Target',
'map' => '',
'zoom' => false,
'debug' => false,
),
leafext_clear_params($atts)
);
...
} elseif ($options['title'] !== '') {
// marker title on the same page / post
$text = '<a href="javascript:leafext_jump_to_map();" onclick="leafext_target_same_title_js('
. '\'' . $options['map'] . '\','
. '\'' . $options['title'] . '\','
. '\'' . $options['popup'] . '\','
. $options['zoom'] . ','
. wp_json_encode($options['debug'])
. ')">' . $options['linktext'] . '</a>';
return $text;
}
This hack seems to work in my case.