Home › Forums › General Issues › New free Google Maps-plugin
Hello,
I just wanted to do a little show-off, as we at Stupid Studio, have just released a new ACF Field.
The plugin is a very simple Google Map-field, created as an alternative to the existing Google Map ACF-field, as we found numerous issues with that one.
Please take it for a spin and do report back, if you find any issues, has feature requests etc.
http://wordpress.org/plugins/advanced-custom-fields-coordinates/
Kind regards,
Stupid Studio
Hi @mortenskyt
Great work on the field, and thanks for sharing.
Just to let you know, I have just built a google maps field and is currently available on the nightly build (github) – this will be released int he next version
Thanks
E
Hello Elliot,
Ah, that’s cool – let’s see how things evolve. Maybe it makes sense to keep both, maybe it doesn’t.
Kind regards,
Morten @ Stupid Studio
Quick question: does your map field save the data I enter? In other words, when I enter an address and save the post, will the address I entered remain?
The reason I ask is because on testing the current location field anything I enter is replaced with the default co-ordinates for Paris!
My expectation is very basic: I enter an address and hit enter, a map is plotted with the correct location and I save the post. When I return to the post the details I actually entered and saved are, well, actually saved!
Paris is great, but it’s not appropriate to show a map of Paris when I want to show a map of Gloucestershire in England.
If your add-on can serve this particular need then I’ll give it a go.
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 @kidcajes
If you are loading the value from a user, please read this doc:
http://www.advancedcustomfields.com/resources/how-to/how-to-get-values-from-a-user/
Thanks
E
Im using the acf-coordinates plugin, i just wanna break the returned coordinates so I can create a google maps out of it.
Hello Kidcajes,
If you use the get_field
method, you will get the fields as an array. For some reason I can’t remember, we decided to serialize into json when saving, instead of as an array, like most other plugins does, so if you want to use get_the_author_meta
, then you’ll have to json_decode($raw_data, true)
to get it out as an array. But I would suggest sticking with the official get_field()-method from ACF. It does support fetching author meta, so there’s no reason to fetch it straight out of WordPress. Using the official ACF-API ensures that any additional data/parsing/restructuring, will be passed along to your functions.
In your case, the working code would be something like:
$var = get_field('locations', 'user_'.get_current_user_id());
and then the $var would contain an array like you expect.
Kind regards,<br />Morten Skyt
The topic ‘New free Google Maps-plugin’ is closed to new replies.
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.