I got that…
added to the geosjon shortcode website and onEachFeature. Just add a website=”” to your shortcode.
$geojson_script = "<script>
WPLeafletMapPlugin.add(function () {
var map_count = {$leaflet_map_count},
previous_map = WPLeafletMapPlugin.maps[ map_count - 1 ],
src = '{$src}',
color = '{$color}',
weight = '{$weight}',
website = '{$website}',
opacity = '{$opacity}',
layer = L.ajaxGeoJson( src, {
color : color,
weight : weight,
website: website,
opacity : opacity,
onEachFeature: onEachFeature,
}),
fitbounds = {$fitbounds};
layer.addTo( previous_map );
if (fitbounds) {
layer.on('ready', function () {
this.map.fitBounds( this.getBounds() );
});
}
function onEachFeature(feature, layer) {
layer.on('click', function (e) {
website = e.target.options.website;
window.location.href = website;
abort;
});
}
});</script>";
-
This reply was modified 8 years ago by theode.