Skip to content

Distance Shortcode

[dms_get_distance] shows how far a listing is from the visitor. Use it on a listing card in your search results or on a vehicle detail template.

It is also available in Elementor as the Get Distance element, in the Listing category.

What it shows

Situation Output
The visitor's location is known (they used the Radius Filter, typed a ZIP, or tapped Near me) The distance, e.g. 12.4 mi
The location is not known yet A Calculate distance button
The listing has no coordinates Nothing at all

Tapping Calculate distance asks the browser for permission and then fills in the distance in place. It uses the same location as the Radius Filter, so tapping it also updates the filter if one is on the page.

Attributes

Attribute Description Default
button Label for the calculate button. Calculate distance
[dms_get_distance button="How far is this?"]

Notes

  • The unit follows the active search (miles or kilometres), falling back to the listing type's Distance Unit setting.
  • On search results the distances refresh whenever the results reload. On a detail page the shortcode works on its own, with no filter needed.
  • Output is a plain inline <span> with the class dms-get-distance — no wrapping block — so it sits inline next to other card details.