We are using your plugin on websites together with the Advanced Custom Fields plugin. Will you maintain compatibility also for the after recent events now external hosted and updated ACF plugin?
Thanks for your plugin, it has been very helpful over the years.
]]>Hi, since the current mobile version user experience is a little challenging (it’s not working on safari ios and double tap to add marker not working), I want to change the map to have only one centered fixed position marker on the map, and user only can drag the map.
But I don’t know where I can change the leaflet acf-input js that handles the map setting.
Could you please give me a hint to achieve this ?
Here is a sample from what i want to do:
https://www.drupal.org/project/leaflet/issues/2164567
like your ACF-plugin and all the awesome features i see.
btw: i want to perform a retrieval to the endpoint of OSM – eg like so.
[out:csv(::id,::type,::lon,::lat,amenity,name,"addr:postcode","addr:city","addr:street","addr:housenumber","contact:website",website,"contact:email")]
[timeout:600];
rel[boundary=administrative][admin_level=6][name="München"] -> .city;
(nwr[amenity=hospital][name](around.city:2000);
nwr[amenity=school][name](around.city:2000);
nwr[amenity=church][name](around.city:2000);
nwr[amenity=childcare][name](around.city:2000);
nwr[amenity=nursing_home][name](around.city:2000););
out center;
well – i could perform this with the following code.
<?php
/*
Plugin Name: ACF Schools Widget
Description: Displays nearby schools using Overpass Turbo and ACF.
Version: 1.0
Author: foo bar
*/
// Exit if accessed directly
if (!defined('ABSPATH')) exit;
// Include ACF
include_once(plugin_dir_path(__FILE__) . 'acf/acf.php');
// Register ACF fields
function register_acf_fields() {
if (function_exists('acf_add_local_field_group')) {
acf_add_local_field_group(array(
'key' => 'group_1',
'title' => 'Nearby Schools Widget',
'fields' => array(
array(
'key' => 'field_1',
'label' => 'Latitude',
'name' => 'latitude',
'type' => 'number',
'required' => 1,
),
array(
'key' => 'field_2',
'label' => 'Longitude',
'name' => 'longitude',
'type' => 'number',
'required' => 1,
),
array(
'key' => 'field_3',
'label' => 'Radius (km)',
'name' => 'radius',
'type' => 'number',
'required' => 1,
),
),
'location' => array(
array(
array(
'param' => 'post_type',
'operator' => '==',
'value' => 'page',
),
),
),
));
}
}
add_action('acf/init', 'register_acf_fields');
// Enqueue necessary scripts
function acf_schools_widget_enqueue_scripts() {
wp_enqueue_script('jquery');
}
add_action('wp_enqueue_scripts', 'acf_schools_widget_enqueue_scripts');
// Shortcode to display schools
function display_nearby_schools($atts) {
$latitude = get_field('latitude');
$longitude = get_field('longitude');
$radius = get_field('radius');
if (!$latitude || !$longitude || !$radius) {
return 'Please provide latitude, longitude, and radius.';
}
// Overpass API URL
$query = '[out:json][timeout:25];(node["amenity"="school"](around:' . ($radius * 1000) . ',' . $latitude . ',' . $longitude . '););out body;>;out skel qt;';
$url = 'https://overpass-api.de/api/interpreter?data=' . urlencode($query);
// Fetch data from Overpass API
$response = wp_remote_get($url);
if (is_wp_error($response)) {
return 'Unable to retrieve data.';
}
$body = wp_remote_retrieve_body($response);
$data = json_decode($body, true);
if (empty($data['elements'])) {
return 'No schools found in the specified area.';
}
// Display data
$output = '<ul class="nearby-schools">';
foreach ($data['elements'] as $element) {
if (isset($element['tags']['name'])) {
$output .= '<li>';
$output .= esc_html($element['tags']['name']);
if (isset($element['tags']['website'])) {
$output .= ' - <a href="' . esc_url($element['tags']['website']) . '" target="_blank">' . esc_html($element['tags']['website']) . '</a>';
}
$output .= '</li>';
}
}
$output .= '</ul>';
return $output;
}
add_shortcode('nearby_schools', 'display_nearby_schools');
and display this in a widget in WordPress. Well i would like to use your plugin here – to get this done — and to show the results in a little table
]]>Hi, first of all thanks for your plugin. It’s great.
I don’t know when it starts as a customer just said to me yesterday there was a problem.
As on said on this post from jonccg: https://www.ads-software.com/support/topic/lat-long-dont-save-after-drag-n-drop/ if we update manually the position in the back end, we still get the former gps values in the front-end. Lat and long are always the same in the acf field array.
Is there something we can do ?
Best regards.
]]>Hello, I am using ACF and want to use ACF Openstreet map Field But the ACF openstreetmap is not working. The map is not loading to the website. As you can see the image
]]>Hi,
Just updated to ACF 6.3.3 and encountered a PHP fatal error when I tried to edit a page with an ACF Block containing an ACF OpenStreetMap Field. If I roll ACF back to the previous version (6.2.9) the issue disappears. Has anyone else found this?
PHP message: PHP Fatal error: Uncaught TypeError: stripslashes(): Argument #1 ($string) must be of type string, array given in /wp-content/plugins/acf-openstreetmap-field/include/ACFFieldOpenstreetmap/Field/OpenStreetMap.php:838
]]>Since ACF disabled the shortcodes, I can no longer display the maps. Does anyone know a way to display them without using shortcodes?
]]>missing the line with the insert field for the adress with the magnifier. Does someone knows any solution for this?
Thanks!
Cyrock
Hi there,
First of all thanks for your plugin. I’m using it on mutliple website and i like it so much !
Today, a custommer ask me a question.
When i’m searching for an adress the point on the map is set.
But if the point is not really at the good place i want to move it a lil bit and keep the adress.
However, in the front i don’t have the new position ! Only the old one when it transform the adress in point.
Is there a way to change it ?
Maybe a js script i can manage in the hook save post ?
Regards
Jo
Hello! I have installed the ACF OpenStreetMap Field plugin but when I try to edit the “Map Apperance” in ACF, the map space appears gray and I cannot see the map. The same thing happens to me when I try to create a page with the map field on the editing page.
Can anyone help me?
Thanks!
Hi, I use ACF openStreetMap in my latest project. I inserted the map into a modal window, but when I load the modal I only see one tile in the map. I tried with:
jQuery(document).ready(function () {
map.invalidateSize();
});
map is not defined.
Can anyone help me?
]]>Hello,
In ACF 6.2.5 Security Release It is stated
https://www.advancedcustomfields.com/blog/acf-6-2-5-security-release/
This release is a security fix release containing an important change you need to be aware of before you update, and prepares for a change to the output of the_field coming soon to ACF.
ACF indicates :
ACF — ACF will soon escape unsafe HTML that is rendered by the_field(). We’ve detected the output of some of your fields will be modified by this change. Learn how to fix. Hide details
carteosm (carteosm) – rendered via the_field
Can you tell us how to comply with this new security rule?
Thanks
]]>Hello,
In ACF 6.2.5 Security Release It is stated
https://www.advancedcustomfields.com/blog/acf-6-2-5-security-release/
This release is a security fix release containing an important change you need to be aware of before you update, and prepares for a change to the output of the_field coming soon to ACF.
ACF indicates:
ACF — ACF will soon escape unsafe HTML that is rendered by the_field(). We’ve detected the output of some of your fields will be modified by this change. Learn how to fix. Hide details
carteosm (carteosm) – rendered via the_field
Can you tell us how to comply with this new security rule?
Thanks
]]>Maps just stopped working.
I get this error in the backend where I set/create the map.
Uncaught No such provider (OpenSeaMap)
Is there any solution?
I tried downgrading to 1.5 – 1.4 but still the problem persists!
Thanks.
Hi, I have the following error:
Uncaught No such provider (OpenSeaMap)
map-input.js
if ( ! providers[providerName] ) {
throw 'No such provider (' + providerName + ')';
}
I had to momentarily go down to version 1.5.0 to resolve.
]]>the logs of the server a flooding with error messages:
[error] 64971#64971: *1560848 FastCGI sent in stderr: “PHP message: PHP Warning: Undefined array key “layers” in /www/XXXXXXX/public/wp-content/plugins/acf-openstreetmap-field/include/ACFFieldOpenstreetmap/Field/OpenStreetMap.php on line 602″, client: 185.173.217.217, server: royaldelft.com, request: “GET XXXXX HTTP/2.0”, host: “royaldelft.com:35227”, referrer: “https://royaldelft.com/XXXXXX”
Any idea why this is causing error’s on PHP 8.2? ACF OpenStreetMap Field v 1.5.4
]]>Hello,
I’m using ACF Openstreetmap field since a few years. This morning, I’ve updated from 1.5.0 to 1.5.3 and the field doesn’t work anymore. When I enter an address and press on Enter or click on the button, nothing happens.
I’ve got a 1.5.0 version on my local save, so I’ve downgraded my plugin with this files and it works again.
It seems that I’m the only one having this issue. I’m using ACF Pro and ACF Font Awesome too.
Can someone help me please ?
]]>Hello,
The last update stiil crash ACF block. I have screened my test for better understanding.
Thanx.
]]>Firstly, there is issue with template, which I have to copy out from plugin to my theme to load it there properly.
Secondly, when there is error on the page, it goes 500 error, because there is string and expecting PHP Array.
I fixed it with custom changes to min.js input file, but still getting a lot of problems to be fixed.
]]>Hello,
I’m working with ACF Openstreetmap Field on a client website.
I enter an address in the administration (let’s take “Route de Cruciata, 20166 Pietrosella, France Corse”) and when I zoom on the map, everything is fine, I’ve got something like this position : 41.8440158, 8.7823428.
But when I display the map on the website, with datas, I’ve got an address somewhere not far, but not on the exact point (like 500m away : 41.8368279,8.7780762).
When I look at the lng and lat values, they are already wrong. Something happens between the save in the administration and the recovery of the data in my file.
Here is part of my code :
jQuery(document).ready(function($){
var zoomvalue = 4.8;
var largeurf = $(window).width();
if(largeurf >=768){ zoomvalue = 5.4;}
if(largeurf >=992){ zoomvalue = 5.5;}
if(largeurf >=1200){ zoomvalue = 5.6;}
// console.log(zoomvalue);
//Initialisation de la carte sur Londres
var map = L.map('carte-programmes').setView([46.5177483, 0.6572277], zoomvalue); // LIGNE 18
//Ajout du fond de carte
var Jawg_Streets = L.tileLayer('https://{s}.tile.jawg.io/jawg-sunny/{z}/{x}/{y}{r}.png?access-token={accessToken}', {
minZoom: 0,
maxZoom: 22,
subdomains: 'abcd',
accessToken: 'XXXX (hidden on purpose)'
});
map.addLayer(Jawg_Streets);
//Mise en place des clusters et du CSS des clusters
var markersCluster = new L.MarkerClusterGroup({
iconCreateFunction: function(cluster) {
return L.divIcon({
html: cluster.getChildCount(),
className: 'mycluster',
iconSize: null
});
}
});
//Customise les icones de marqueur au zoom
var customIcon = L.icon({
iconUrl: '<?php print $img;?>marker.png',
shadowUrl: '<?php print $img;?>marker-shadow.png',
iconSize: [64, 64], // taille de l'icone
shadowSize: [64, 64], // taille de l'ombre
iconAnchor: [32, 64], // point de l'icone qui correspondra à la position du marqueur
shadowAnchor: [32, 64], // idem pour l'ombre
popupAnchor: [-3, -76] // point depuis lequel la popup doit s'ouvrir relativement à l'iconAnchor
});
L.Marker.mergeOptions({
icon: customIcon
});
//Prépare tous les marqueurs correspondants aux programmes et génère les popups
<?php foreach($idsprog->posts as $idprog):?>
var latLng = new L.LatLng(<?php print get_field('adresse',$idprog)['lat'];?>,<?php print get_field('adresse', $idprog)['lng'];?>);
var marker = new L.Marker(latLng);
marker.bindPopup(
'<a href="<?php the_permalink($idprog);?>" class="produit popup_carte">' +
'<div class="visuel">' +
'<img src="<?php print get_field('vignette',$idprog)['sizes']['330x200'];?>" />' +
'<div class="textes-visuel">' +
'<div class="type"><?php foreach(get_field('type_logement',$idprog) as $type):?><?php print $type;?><span class="slash"> / </span><?php endforeach;?></div>'+
'<div class="livraison">Livraison <?php print (get_field('annee_livraison',$idprog) > 1) ? the_field('annee_livraison',$idprog) : 'immédiate';?></div>' +
'</div>' +
'</div>' +
'<div class="textes">' +
'<h4><?php print get_the_title($idprog);?></h4>' +
'<div class="lieu"><?php print addslashes(get_term(get_field('lieu',$idprog), 'lieux')->name);?></div>' +
<?php if( have_rows('prix',$idprog) ): the_row();?>
'<div class="prix">à partir de <?php print preg_replace('/(?<=\d)(?=(\d{3})+$)/', ' ', trim(get_sub_field('prix_prog',$idprog)));?>€</div>' +
<?php endif;?>
'</div>' +
'</a>'
);
markersCluster.addLayer(marker);
<?php endforeach;?>
map.addLayer(markersCluster);
});
Thank you for your help. The website seemed to work since 2-3 years but now there is this problem, I don’t know if it’s really new or if we missed it, but it would be odd that I didn’t saw it earlier…
]]>Hey there! Wow, you’ve done an awesome job with this plugin, thank you so much! I was wondering if this plugin is still being actively maintained or if it has been abandoned. I’m considering using it for a project and I just want to make sure that the plugin is regularly updated. Your confirmation would be greatly appreciated!
]]>Hi There,
I’m currently using this plugin to store OSM data on a custom post type. I’m wanting to show an OSM map on the home page which has location pins from every custom post type, with the ability to click on the pin and be taken to the page for that post.
Is this something this plugin can do? or could you provide me some direction on how I could do this myself?
– Chris
]]>I have a weird problem where when I search for a street by it’s Finnish name, the map returns suggestions that are in Swedish regardless of what languages are chosen as accepted languages and preferred languages in the browser’s settings, regardless of the site’s language being Finnish and every user’s language being Finnish and regardless of the fact that the Swedish language is not even installed or used anywhere on the site.
]]>The search field works if you validate via the enter key on the keyboard,
but the button does not work.
Hello,
When I create a post, a marker automatically appears on the map. Is it possible to avoid this? I’ve set up some logic, but it doesn’t work. I don’t want all my posts to have a marker.
Thanks for your help
]]>I’ve just updated the plugin to the latest version Version 1.3.5 and the map now won’t load on the frontend using Leaflet JS. It does load in the backend fine. It will load on the frontend if I select iFrame (OpenStreetMap.org), but I want to be full screen width.
Am I doing something wrong or is there an issue with Leaflet JS?
]]>In version 1.3.5 there is no layer selection available even if the “allow layer selection” option field is activated!
]]>Hello, is it possible that the location link to Google Map is displayed?
]]>Anyone ever get this to work with Beaver Builder? I am hitting a wall.
]]>i am using this plugin and created a frontend from, i need to display autosuggest result how can i enable this feature?
]]>