Question

I have a location field to my posts and i would like to add a dropdown with some presets that when choosed updates the maps location and sets the lat and long.

I might get this done by modifing the plugin and its js but i dont want to do this because i want to be able to update the plugin when new versions comes out.

Any idea? i've been looking for actions or filters but had no luck and still have no idea how to set the map position dynamicly.

Thanks in advanced.

Was it helpful?

Solution

Well, just in case someone have the same need this is what i did:

  1. Add an acf dropdown with and id
  2. Add an javascript to load only in the admin of the wordpress
  3. Add an "onchange" event (in the previous script) to generate a new google map inside the container of the original google map container
  4. Update the value of two hidden values that contains the lat and lng of the map

That worked for me, as the hidden values were updated the post can be saved as usual and the values will be stored.

Hope this help someone.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top