From: Anthony Talarico Date: Tue, 22 Oct 2019 17:20:14 +0000 (-0400) Subject: adding click to urls for the map markers X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=7ec807ff72d2e7b17a0f304855c18d9cd842a42c;p=WP-Plugins%2Fglm-leaflet-theme.git adding click to urls for the map markers --- diff --git a/glm-leaflet-theme.php b/glm-leaflet-theme.php index f3bc86e..d9401a2 100644 --- a/glm-leaflet-theme.php +++ b/glm-leaflet-theme.php @@ -28,12 +28,15 @@ add_shortcode('glm-leaflet-theme', 'glm_leaflet_theme'); function glm_enqueue_leaflet(){ global $post; - if(has_shortcode($post->post_content,'glm-leaflet-theme')){ + if($post && has_shortcode($post->post_content,'glm-leaflet-theme')){ wp_enqueue_style('glm-leaflet-style', "https://unpkg.com/leaflet@1.3.3/dist/leaflet.css"); wp_enqueue_script('glm-leaflet', "https://unpkg.com/leaflet@1.3.3/dist/leaflet.js"); wp_enqueue_style('glm-leaflet-font', "https://fonts.googleapis.com/css?family=Montserrat&display=swap"); wp_enqueue_style('glm-leaflet-gesture-style', "//unpkg.com/leaflet-gesture-handling/dist/leaflet-gesture-handling.min.css"); wp_enqueue_script('glm-leaflet-gesture', "//unpkg.com/leaflet-gesture-handling"); + ?> + + Petoskey' }) }).addTo(leafletMap); + ////////////////////// - var petoskeyEast = new L.marker([45.3746, -84.9276]); - petoskeyEast.addTo(leafletMap); + var petoskeyEast = new L.marker([45.3746, -84.9276], {url: window.glm_memberdb_url}); + petoskeyEast.addTo(leafletMap).on("click", function(){ + window.open(this.options.url+"petoskey-east-clinic"); + });; new L.Marker([45.370, -84.9276], { icon: new L.DivIcon({