I’m not certain, but two things I think you should try:
$value
variable with a foreach instead of using the built in functions.$value
within the loop which is destructive. Return it untouched if you want the fields saved, or wipe it clean if you want to use the data but not save any of it. Either way, outside the loop.Hope those help.
I see the map full of markers. And the code looks fine too. Is this solved?
You can also use get_field('counter_repeater');
which will return an array and then target whichever line you need.
$array = get_field('counter_repeater');
echo $array[2]['counter_number'];
Cleaner than strings I’d imagine.
I edited core code to do this, but a better approach might be to use the saved lat/long to query google and get exactly the components you want.
Just send it through this and it’ll give you JSON:
http://maps.googleapis.com/maps/api/geocode/json?latlng=44.4647452,7.3553838
Bringing up an old topic again, but I’m interested in exactly the same thing. The google map field stores the full address as a single field and the coords. Although I can look this up and finally display the city/country, it takes an additional call to Google and it doesn’t show the editor what they’re actually selecting.
A filter hook doesn’t work for the same reason: another call to google, and the JS display isn’t affected. I’ve edited acf-input.js to achieve this, but of course core edits aren’t a great idea.
Could we, along with address and lat/long, also store the rest of the components google provides so we can grab any of them?
Additionally, could we restrict the Place Types, add a location bias or restriction? Eg: Only show results for cities. Only show results within a country.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.