@mortenskyt hi can you help me with this?
Im using the acf-coordinates plugin, i just wanna break the returned coordinates so I can create a google maps out of it.
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!
Hi E,
Thanks! It works. I also tried using nested repeater and it works better and easier.
Cheers!
Hi E,
Target Output:
Alabama (state_name)
– auburn (city_name)
– birmingham
– dothan
Illinois
– bloomington
– urbana
– chicago
My Current Output:
Alabama
– auburn
Alabama
– birmingham
Alabama
– dothan
Illinois
– bloomington
Illinois
– urbana
Illinois
– chicago
I hope this clear things up!
Cheers
Hello I need help guys! 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!
🚨 The 2023 ACF Annual Survey closes tomorrow! This is your last chance to complete the survey and help guide the evolution of ACF. https://t.co/0cgr9ZFOJ5
— Advanced Custom Fields (@wp_acf) May 18, 2023
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.