In WordPress, there’s an Advanced Custom Fields Google Map option. I’m using that to refer to the address as text at one point. Code used:
<?php the_field('address');?>
Address is the custom variable for the Google Map.
This displays the street, city, state, zip code, country and latitude and longitude.
I don’t need the country, lat or long. I’ve been trying to find an array I can edit, but no luck so far.
Thanks!
If you use
get_field()
instead ofthe_field()
it will give you an array of 3 elements: address, lat and lng.Unfortunately address is a string with the full address, country name included.
But if it’s always the last voice separated by a comma, you can retrieve just the address string until the last comma, something like this: