Turn map marker into url link

Avoid popup and open a new page on clicking marker.

Map

When using the maps, content is loaded from third-party servers. If you agree to this, a cookie will be set and this notice will be hidden. If not, no maps will be displayed.


[leaflet-map fitbounds]
[leaflet-marker lat=51.30493800 lng=13.55414900 title="TP Großenhain"]https://www.openstreetmap.org/node/2447720821[/leaflet-marker]
[leaflet-marker lat=51.29820310 lng=13.49503900 title="TP Raschütz"]https://www.openstreetmap.org/node/2448235160[/leaflet-marker]
[leaflet-marker lat=51.31248810 lng=13.62072590 title="TP Quersa"]https://www.openstreetmap.org/node/5628688329[/leaflet-marker]
[hover]
[zoomhomemap]
[gestures]

Code

Insert this as a HTML Block after the map:

<script>
window.WPLeafletMapPlugin = window.WPLeafletMapPlugin || [];
window.WPLeafletMapPlugin.push(function () {
	var map = window.WPLeafletMapPlugin.getCurrentMap();
	if ( WPLeafletMapPlugin.markers.length > 0 ) {
		for (var i = 0; i < WPLeafletMapPlugin.markers.length; i++) {
			var a = WPLeafletMapPlugin.markers[i];
			a.on("click", function (e) {
				if (typeof e.sourceTarget.getPopup() != "undefined") {
					a.url = e.sourceTarget.getPopup().getContent();
					window.location = (a.url);
				}
			});
		}
	}
});
</script>
Nofollow!