Custom Fields
Support Meta Box Geolocation Retrieve coordinates while providing address

  • Creator
  • #11408
    Resolved Aaryn Ehlers

    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
  • #11421
    Anh Tran

    Hi Thomas,

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

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

    View post on

    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.