How to Use Dynamic (ACF) Data in the “Map (Leaflet)” Element?

Hi everyone,

I’m trying to use dynamic data from ACF fields in the Map (Leaflet) element, but I can’t figure out how to connect them properly.

Here’s what I’ve tried so far:

  • In the Map (Leaflet) element settings, I see fields for latitude, longitude, address, etc., but they don’t seem to accept dynamic data tags.
  • I tried using dynamic data tags like “{acf_latitude}, {acf_longitude}” in the Coordinates field, but the map doesn’t update or display correctly.
  • When I hard-code the coordinates and only use ACF fields inside the Popup (Text) field, the popup shows the variable names (e.g. {acf_address}) instead of the actual field values.

My goal:

Display a Leaflet map on a post or listing template, where the map automatically uses the coordinates stored in ACF fields.

Questions:

  • Is it possible to use ACF (or other dynamic) data in the Map (Leaflet) element?
  • If yes, what’s the correct way to reference dynamic fields for latitude/longitude or address?
  • If not currently possible, is there a workaround (e.g., custom code or dynamic data filter)?

Many thanks for any support!

Best,
Chris

The hardcode input is like 11.1111111111,22.2222222222 where the comma separates the long and latitude. So i assume, that’s how you should input it. So that space in your example might break it.

Try outputting it in a text field to see what happens combining those 2 values and see if they match the hardcode working version.
Some dynamic data filters that might help:

:raw
:value
:plain

These go like {acf_latitude_value:raw}

@Ferry

Thank you very much for your suggestions. Unfortunately, none of the approaches worked. I’ve tested all dynamic data filters, both with and without spaces. I don’t believe the space is the issue, as the example provided by Bricks Builder also includes one.

I tried using hardcoded numbers (52.5, 13.4) with and without spaces — both versions worked perfectly. However, when I copied the same values into an ACF text field, it still didn’t work.

Hopefully, someone will eventually create a video tutorial that clearly demonstrates how to implement this.

i tested it, and it works just as i say so.

Got an acf lat and longtitude field.

The image below shows the outputs of the acf fields just like the map input. And it centers right where it should.

The 2 fields come from a custom post type that is loaded inside the query outputting the map.
The word test is the post content

Shouldn’t it be a number field rather than text?
AJ

i used a text field because of the comma and dot

I also output the coordinates s text just to see them working.

Are you sure your coordinates are inside the the query ?
(explanation) to get data from some other place than hard coded, you need to pull it. Thats what a query does. So even though it may output just 1 result, it needs a query or a single post page because these link the posts data to be available for output.

Same goes for the Markers

@Ferry

That was an excellent tip — thank you! I had been wondering how to properly configure the query loop in the Map (Leaflet) element.

In the Map (Google) element, the query loop is configured via Map (Google) → CONTENT → ADDRESSES → QUERY LOOP. Since this option is missing from the Map (OSM) element, I assume that the query loop likely needs to be configured within the parent container of the Map (OSM) element instead.

Screenshot 2025-10-31 um 11.39.41

I am currently testing this setup using a small ACF dataset containing five entries. It seems, however, that configuring the query loop at the parent level results in five map instances being rendered — each layered on top of the previous one — so that only the final database entry remains visible.

Here’s a screenshot of my current query loop settings.

What am I missing?

By the way, my earlier assumption that the issue was caused by format incompatibilities was likely incorrect. It doesn’t appear to make any difference whether {acf_latitude} and {acf_longitude} are defined in the ACF database as text or number fields, nor does the presence or absence of a space after the comma affect the results — the behavior remains the same.

The query will render the number of results it obtains. So if you have 5 posts to that posttype, the query will render 5.

Looking at the structure, container with query, map element. it is finding 5 posts and thereby rendering the map, as query output, 5x.

Not sure if you want only 1 item to be rendered, then the query has to be refined of get only the 1 you want.

Or, you want to display 5 items with own maps, then you need to add the post content to it.

So the thing below the container with the query will repeat itself for all posts it finds. So you make 1, and that goes in repeat.

structure be like:
level 0 - Container with query (loop)
level 1 - container for post item
level 2 - post title
level 2 - post content
level 2 - map

@Ferry

Thank you all very much for your patience! I’m still having a bit of trouble finding the right approach.

Several AI tools have suggested using an ACF repeater field (or custom JavaScript/PHP code) to handle multiple markers. However, since the repeater field is part of ACF Pro, I’ll continue using the Map (Google) element for now, as it already supports multiple markers out of the box.

I would generally prefer to use OpenStreetMap, but that doesn’t seem to be a practical option at the moment.

I’ll also submit a feature request to add similar functionality to the Map (Leaflet) element — it would be a great enhancement for future versions!

Now I’m getting confused. The topic title says leaflet map.

Repeater fields seem unnecessary as it only complicates things. Might be used for several markers. But long and latitude input will make it more difficult to query the results. If all markers go on 1 map you might be able to separate them with some tag, allowing a normal field to be sufficient.

Google Maps require an api with Google setup for credits the maps consumes.
Might even cost real money on heavy usage.

OpenStreetMap doesn’t seem to be built into Bricks and thereby requires an extra plugin or so. HTML can be embbeded as an iframe. (not a fan off). Not sure if you can easily connect it to an custom field for the marker.

https://wiki.openstreetmap.org/wiki/Export#Embeddable_HTML

OpenStreetMap does have nicer layouts.
Also, supporting normal addresses would be a nice option instead of coordinates.

For Google Maps, in the past it could be embedded without api hassle, but now if i look it up, it also needs an api. (maybe there are other ways, not sure, but for the API i would go for a free map instead).

Dit you get the leaflat map working with long and latitude input by custom field?

Apologies — my initial question may not have been precise enough. I was referring to the official Bricksbuilder Map (Leaflet) element, which was introduced in version 2.1.

Could you please clarify which OpenStreetMap element you were referring to? I’m very interested in switching from Google Maps to OpenStreetMap for several reasons.

I completely agree — OpenStreetMap with clustering looks much more elegant than the clustered Google Maps version.

Once again, many thanks for your support, and apologies for the earlier confusion.

You mentioned Leaflat, OSM (open street map) and Google map, so i wasn’t sure anymore which one you’re planning on using.

Only Leaflet and Google map are built in Bricks, so only these will integrate best.

Openstreetmap is a free to use map, but because it is not build in it will take more effort to integrate the position and markers.

Leaflat map has options to change the looks, but it is going to require some work to figure it all out.

https://leafletjs.com/reference.html

The “Map connector” element seems to be able to translate an address to coordinates and has marker options so might be worth to check out.
I havent, but i will as this can save a lot of coordinate pinpointing and maybe even translate a customer address to its coordinates.

Leaflet would be my preferred option as i don’t want the Google API hassle.

Leaflet map to grayscale is easy as adding this code to its cssbox
%root% {filter: grayscale(1);}

I was wondering if you have the coordinates from the acf fields working already as that was your main question?

Hi Guys,

I’m currently working on this too and am determined to solve it with OSM (or at least wo google)

What works for me:

  • As far as I can tell, inserting manual and custom field latitudes and longitudes works with the ‘Map Leaflet’ Element (with OSM standard map preset)
  • several manual input adress data on one map

What doesn’t work for me is

  • showing several custom field posts on one map / custom field query loop inside the map element. Best i got until now is parent element query loop where it creates a map for every custom post.
  • Tried to look into the ‘map connector’ element but couldn’t make use of it until now, i guess the setting ‘sync with query’ it requires just works with google maps?
  • Also couldn’t find any Tutorials neither on the connector element, nor on the Leaflet+OSM (without additional plugins)

If anybody knows solutions please tell me.

Greetings
Philip

The map connector element only seems to works with google maps

Not even sure if can “load“ the markers as a query inside leaflet. Documentation says: Marker Repeater – add multiple markers

But does not specify the way to input them.

While for google maps you seem to be able to input a repeater array

Thereby outputting all markers inside 1 map instead or duplicating the map for every result found as a query would.

well this feature is coming to snn-brx very soon

this is not released yet but it works fine inside the alpha release already

have fun

check the video to see how to setup

1 Like