Use Lat/Lon from Meta Box Data

If you are using Meta Box, especially the Open Street Map field type, the selected map location is stored as a single comma-separated value:

"location_map": "36.6296156,-83.5249284,14"

That value includes latitude, longitude, and zoom level. To use those values separately in a front-end map, use the split() modifier to split the string by the comma delimiter:

item.metabox.location_map.split(‘,’)[0] // latitude
item.metabox.location_map.split(‘,’)[1] // longitude
item.metabox.location_map.split(‘,’)[2] // zoom

Leave a Reply

Your email address will not be published. Required fields are marked *