Skip Navigation

[Resolved] Displaying and Order by distance

This thread is resolved. Here is a description of the problem and solution.

Problem:

I created a working search page with Enter a location/Use my location (no map). Where can I set the option to order the results by distance?

Solution:

You can follow our document to setup the distance filters and sort the result by distance:

https://toolset.com/course-lesson/filtering-and-ordering-map-markers-by-distance/

Relevant Documentation:

This support ticket is created 3 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 2 voices.

Last updated by Omek 3 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#2083543

I created a working search page with Enter a location/Use my location (no map). Where can I set the option to order the results by distance?

I'm using the shortcode to display distance and I get "Your location is needed to show this content." error on some devices and browsers. Chrome and Android device displays the distance but the number never changes when I input an address, it seems to be stuck on the distance from my location. Firefox and Iphone I see only the error.

hidden link

Please advise

#2084169

Hello,

You can follow our document to setup the distance filters and sort the result by distance:
https://toolset.com/course-lesson/filtering-and-ordering-map-markers-by-distance/

If you want to display the distance value between user input value and custom address field value, you can try the option:
URL parameter (useful with custom distance filter)

See screenshot of above document:
https://toolset.com/wp-content/uploads/2018/12/show-the-distance-between-two-points.png

#2084981
field-settings.jpg
filter.jpg

I've already gone over the page you've suggested several times and it doesn't actually detail how to get results working by distance. Toolset has been smooth sailing until I ran into this distance issue.

I'm using the Block editor. The Distance Filter was already there, I've attached a screenshot of my filter and the field settings. Still cant get it to work

The order of the results don't change even when I use one of the result addresses in the Enter a Location field on the search page.
I just want the results to be ordered by distance and to display how far, the way most directories would have it.

I don't know where to find the distance value settings in the screenshot. Again, I'm using block editor, am I using the wrong editor, I came across a few posts about people confused about what editor they should be using with Toolset.

This is the shortcode I added to the view loop in the results
[wpv-geolocation]
[toolset-maps-distance-value origin_source='visitor_location' postmeta='wpcf-office-address' unit='mi'] miles
[/wpv-geolocation]

I'm still having issues across browsers

Please Advise

#2085329

Although I don't plan on using Elementor, this tutorial (hidden link) was helpful to create custom search via backend Views with the classic editor.

I believe I'm on the right track now

Is the classic editor the only way to get the distance correct? How can I achieve a page to be styled as good as it is with View blocks?

#2086941

Toolset Blocks plugin is based on WordPress Blocks editor, and WordPress Blocks editor is different page builder than Elementor, It is not recommended to design the same page/post with two page builders, this will conduct unexpected result, so you will need to setup the views in classic editor, then put this view's shortcode into Elementor content.

#2089913