Home Forums Backend Issues (wp-admin) gmap field


gmap field

  • Hi
    First i want to thank you Elliot for this wonderful plugin without which my projects would be incomplete.
    I am creating a new project where i have certain custom post types, one being deals.
    Everything is going well including the location retrieval , but very recently a requiremnet has arisen where i need to put the lat/ln values in the following format inside an anothr field.
    example:(33.4567,-121.25987 )
    You may ask why i need this . The thing is i have to sort /order the deals based on distance from teh visitor ( ia m using MaxMind api to fetch visitor IP and lat/lng).

    I am using a plugin which creates a new table to store the postID, MetaId, lat, lng so that indexing is fast. You know very well that it is not that fast and wont be very fast if my posts increase into thousands .

    Thus i need a snipped of code where in when i type the address of location in gma on backend, another textbox below gmap is filled with the lat/lng vales in format 33.4567,-121.25987 .

    Can ya guide me or help me around this?


  • Hi @kaiser

    You can either write some jQuery to copy / paste the ACF val into the ‘lat/lng’ text box, or hook into the acf/update_value filter and run some custom PHP to save the data into the DB manually.

    It probably easier to use jQuery. You can use the $(document).ready() function to add some functionality to look at the ‘lat/lng’ value, and copy / paste across the ACF value.

    You can also listen to a change on the ‘ACF field’ and copy across the new val.

    So, jump on google and look into the document ready and ‘.on(‘change’)’ events


Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘gmap field’ is closed to new replies.