Home › Forums › Front-end Issues › Google map address › Reply To: Google map address
The above was close… I’m crap with terminology so bear with me. The above doesn’t work because it won’t return the right stuff (see, crap with terminology 😉 )
You have to create a variable for the location field so you can access the address array.
$location = get_field(‘location’)
$address = explode( “,” , $location[‘address’]);
echo $address[0].'<br/>’; //place name
echo $address[1].'<br/>’; // street address
echo $address[2].’,’.$address[3]; // city, state zip
This would display as (using your address example):
Digiplex- Poway
Poway Road
Poway, CA
I would just hard code the word “Location:” above this if you need it at all.
If you do: print_r(explode( “,” , $location[‘address’]));
You will get the array of information that is available from the address object, in case you want country or don’t want street address, etc. Obviously you can tweak the html to your needs when you echo out each thing.
Hope this was helpful!
@kingafrojoe definitely got me on the right path, so thanks dude!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.