WP Geo Query
Adds location search support to WP_Query, making it easy to create completely custom "Find Location" pages.
by Greg Schoppe & Mindshare Labs, Inc · github.com/mindsharelabs/mindshare-geo-query · website
★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/mindsharelabs/mindshare-geo-query/archive/refs/heads/master.zipExample Usage
$query = new WP_Query(array(
// ... include other query arguments as usual
'geo_query' => array(
'lat_field' => '_latitude', // this is the name of the meta field storing latitude
'lng_field' => '_longitude', // this is the name of the meta field storing longitude
'latitude' => 44.485261, // this is the latitude of the point we are getting distance from
'longitude' => -73.218952, // this is the longitude of the point we are getting distance from
'distance' => 20, // this is the maximum distance to search
'units' => 'miles' // this supports options: miles, mi, kilometers, km
),
'orderby' => 'distance', // this tells WP Query to sort by distance
'order' => 'ASC'
));