Home › Forums › General Issues › New free Google Maps-plugin › Reply To: New free Google Maps-plugin
This is one of the very useful plugin in ACF. But I’m just wondering why can’t I pull the values from the field into the front-end. I added the field locations to the user profile.
I tried using this:
$values = get_field(‘locations’);
$lat = $values[‘lat’];
$lng = $values[‘lng’];
$address = $values[‘address’];
tried echoing $address, but to no avail.
So what I did was replace get_field with get_the_author_meta, to make it work like this:
$values = get_the_author_meta(‘locations’);
echo $values;
I echoed out $values and returns:
{“address”:”beverly hills”,”lat”:34.072856123839486,”lng”:-118.40037775767212,”zoom”:16}
But my problem is when i used this;
$lat = $values[‘lat’];
$lng = $values[‘lng’];
$address = $values[‘address’];
echo $address;
Nothing is returned. What could be the problem? Can you help with this?
Or how am i suppose to break the returned
{“address”:”beverly hills”,”lat”:34.072856123839486,”lng”:-118.40037775767212,”zoom”:16}
into three attributes (address, lat, lng)?
I’m looking forward to hear from you.
Cheers!
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.