How to output ACF lat long from map with PHP function

Hey! I have an ACF map and can output the lat/long with the following code:

<?php echo get_field('listing_location')['lat']; ?>
<?php echo get_field('listing_location')['lng']; ?>

How do I translate that into Bricks dynamic “Output PHP function”?

I’ve tried the following, which doesn’t work:


I need this output to render a marker on my Bricks map element.


Writing a seperate function for it works, but I was curious if there’s a way without doing that.

function get_listing_location_lat() {
    $listing_location = get_field('listing_location');
    if ($listing_location && isset($listing_location['lat'])) {
        return $listing_location['lat'];
    } else {
        return null; // or you can return a default value if needed


Hi @johannes

If you are using 1.8beta-2, you can use :array_value filter



Hi @itchycode

This is pretty cool, I’ll give it a try.

Thanks a lot!