• Is there a shortcode for adding a url link to a marker? We are trying to avoid the pop-up box and have the new page load as soon as the user clicks the marker icon.
    We’ve found javascript lines that seem to be doing this, but we would not know where to start to add it. Our site is hosted on wordpress.com and we’re using the bravada theme.
    Thank you

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • andynz

    (@andynz)

    I have the same question.

    Andy

    Plugin Contributor hupe13

    (@hupe13)

    It is a shortcode and a html block:

    [leaflet-map fitbounds]
    [leaflet-marker lat=... lng=...]https://domain-a.tld/path[/leaflet-marker]
    [leaflet-marker lat=... lng=...]https://domain-b.tld[/leaflet-marker]
    [hover]
    [zoomhomemap]
    <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>

    [hover] and [zoomhomemap] are shortcodes from Extensions for Leaflet Map.

    (Code taken from here.)

    • This reply was modified 3 years ago by hupe13.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘turn map marker into url link’ is closed to new replies.