From 1d1d14646ef6de6390b28ae5f656589e16c2a7db Mon Sep 17 00:00:00 2001 From: "Jorge vitrubio.net" Date: Mon, 1 Apr 2024 14:06:12 +0200 Subject: [PATCH] leaflet mods: added tilte on hover, added personalized color, changed marker --- includes/xarxaprod-leafletmap.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/includes/xarxaprod-leafletmap.php b/includes/xarxaprod-leafletmap.php index b24af9f..839d106 100644 --- a/includes/xarxaprod-leafletmap.php +++ b/includes/xarxaprod-leafletmap.php @@ -22,7 +22,7 @@ if ( ! is_plugin_active( 'leaflet-map/leaflet-map.php' ) ) { if (! function_exists( 'xarxaprod_show_leaflet_map' )) { function xarxaprod_show_leaflet_map() { // show the map - echo do_shortcode( '[leaflet-map fitbounds lat="41.3922" lng="2.1755" height="100%" width="100%" tileurl=https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png scrollwheel detect-retina]'); + echo do_shortcode( '[leaflet-map fitbounds max_zoom="18" lat="41.3922" lng="2.1755" height="100%" width="100%" tileurl=https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png scrollwheel detect-retina]'); } }; @@ -46,14 +46,15 @@ if ( ! is_plugin_active( 'leaflet-map/leaflet-map.php' ) ) { // else use the ACF OpenStreetMap nominatim value $associat_address = $marker['label']; }; - $associat_xxp_weblink = '' . get_the_title() . ''; + $associat_name = esc_html( get_the_title() ); + $associat_xxp_weblink = '' . $associat_name . ''; $associat_own_weblink = '' . get_field('xxp_associat_web') . ''; $associat_email = '' . get_field('xxp_associat_mail') . ''; $associat_lat = $marker['lat']; $associat_lng = $marker['lng']; - $associat_blobcolor = get_field('xxp_associat_colormap'); + if( get_field('xxp_associat_colormap') ){ $associat_blobcolor = get_field('xxp_associat_colormap'); }else{ $associat_blobcolor = '#555'; }; echo do_shortcode( ' - [leaflet-marker svg background="#555" color="#555" iconSize="17,19" iconClass="dashicons dashicons-marker" opacity="0.6" lat=' . $associat_lat . ' lng=' . $associat_lng . ']' + [leaflet-marker svg background="'. $associat_blobcolor . '" color="'. $associat_blobcolor . '" iconSize="22,22" iconClass="dashicons dashicons-info" opacity="0.6" title="' . $associat_name . '" lat=' . $associat_lat . ' lng=' . $associat_lng . ']' . '

' . $associat_address . '

' . '
' . $associat_xxp_weblink . '
' . '

' . $associat_own_weblink . '

'