GeoDirectory shows a distance on a listing when it has a point to measure from. That point comes from a near search, where the visitor typed a place in the near box or chose Near: My Location. The distance is printed by GD > Distance To Post, which is already part of the default archive item template as [gd_post_distance].
Where the distance appears
- Search results for a near search show the distance from the searched place to each listing.
- On a listing details page, GD > Distance To Post shows the distance from the listing being viewed. A GD > Listings on the details page sorted by Distance to current post (details page only) gives you a nearby listings section with distances.
- Archive pages without a near search have no starting point, so GD > Distance To Post shows nothing there.
Distances use the unit from GeoDirectory > Settings > General > Search > Search distances (miles or km).
Sorting by distance
When a near search is active and the visitor hasn’t picked a sort order, results are sorted nearest first.
With the Advanced Search add-on, the Distance search field has a Show distance sorting option. It adds Nearest and Farthest to the sort options, with labels you choose. See the Advanced Search setup guide.
Custom archive item templates
If you’ve built your own archive item template, add GD > Distance To Post to it where you want the distance. Its options are in GD > Distance To Post.