Support

Account

Home Forums ACF PRO Search posts between two coordinates

Helping

Search posts between two coordinates

  • Hello,
    I’m using ACF plugin in one WordPress theme, with a custom post named ‘listings’, every listing has a Google map ACF field called ‘location’ i see that the plugin save the informations in the database like this:

    meta_key: location
    meta_value: Bormio | 46.4663571,10.370467100000042

    Now i would like to show a list of listings between a range of coordinates starting from the two saved in the single listing location:

    For example:
    In the single post page that show the info about listing called Bormio i want to show a list of listings that have coordinates between this two coordinates
    46.7663571( the result of 46.4663571 + 0.3 ) and 10.670467100000042 ( the result of 10.370467100000042 + 0.3 )

    So i tried a lot of code solutions but i haven’t found the correct one.

    Do you have some solution to porpose to me?

    Thanks.

  • Hi @fmaso

    I believe you can do it by using the coordinates, but you need to know how latitude and longitude works. For something like that, I believe Google Map support forum is a better place to ask that thing.

    After you get the right method, you can use it to query the custom posts or use wpdb if it’s not possible.

    I hope this makes sense. Thanks 🙂

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

You must be logged in to reply to this topic.