Custom Fields
Re-Envisioned
Support Meta Box Geolocation Retrieve coordinates while providing address

  • Creator
    Topic
  • #11408
    Resolved Thomas A Marchisa
    Participant

    I’ve looked everywhere, (well almost), for a PHP or shortcode function that uses geolocation to return the lat and lng coordinates when given an address. Does Meta Box Geolocation provide a function? I’m not concerned with displaying the results , just getting the values themselves. I’ll put the function in my child-theme functions.php file. I thought I could use a autocomplete custom item to store lat and lng fields for my posts that have the custom fields, and have tried to follow the instructions in the documentation, but I can’t get that approach to work.

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #11421
    Anh Tran
    Keymaster

    Hi Thomas,

    To use the Geolocation extension to retrieve latitude and longitude, please create 2 fields with ID lat and lng as follows:

    https://ghostbin.com/paste/5dpyd

    When you select an address from the suggestion list, the latitude and longitude are auto populated:

    View post on imgur.com

    Then on the front end, you can use the rwmb_meta function to get their values.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.

Newsletter

Subscribe to our newsletter to receive news and tutorials for Meta Box and WordPress.


grid gear info copy caret-up caret-down trash