* */ // Detect plugin. For use on Front End only. include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // check for plugin using plugin name if ( ! is_plugin_active( 'leaflet-map/leaflet-map.php' ) ) { // echo '

The plugin LeafletMap is needed to show this map

'; } else { if (! function_exists( 'xarxaprod_show_leaflet_map' )) { function xarxaprod_show_leaflet_map() { // show the map echo do_shortcode( '[leaflet-map fitbounds max_zoom="16" 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]'); } }; if ( ! is_plugin_active( 'acf-openstreetmap-field/index.php' ) ) { echo '

The plugin ACF OpenStreetMap Field is needed to show the points in the map

'; } else { if (! function_exists( 'xarxaprod_show_leaflet_associat_blob' )) { function xarxaprod_show_leaflet_associat_blob() { // get the field values // https://www.advancedcustomfields.com/resources/get_field/ // var_dump get_field(''); $args = get_field('xxp_associat_osm_map',false, false); if ( count( $args['markers'] ) ) { foreach ( $args['markers'] as $marker ) { // define the fields for the blob if ( get_field('xxp_associat_citymap') ){ // if city for map written use it $associat_address = get_field('xxp_associat_citymap'); } else { // else use the ACF OpenStreetMap nominatim value $associat_address = $marker['label']; }; $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']; if( get_field('xxp_associat_colormap') ){ $associat_blobcolor = get_field('xxp_associat_colormap'); }else{ $associat_blobcolor = '#555'; }; echo do_shortcode( ' [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 . '

' . '

' . $associat_email . '

' . '[/leaflet-marker]' ); // end shortcode each marker }; // end each marker }; // end count all markers }; }; //end function xarxaprod_show_leaflet_associat_blob };//end ACF OpenStreetMap active };