I want to sort a view directly using its parameters.
Explanations:
The page displays posts by location, based on a radius set in the view filter.
The problem is that the posts are not sorted by distance from the mapcenter.
I need the view to be sorted by the same value as mapcenter (which is used to define the posts to display)
Sorting works fine when I choose a location manually (fixed). I would like this location to be the same as the one defined in the "mapcenter" filter. I tried to insert a shortcode but it didn't work.
Do you have a solution for this?
Best thanks for you help again 🙂
Hi there
Please see the linked erratum about this known problem, which includes a workaround: https://toolset.com/errata/cannot-order-results-by-distance-in-views-created-with-the-block-editor/
The relevant setting is missing from the block editor and we have an internal ticket to add it.
Hi Nigel, thanks for you answer
Im using legacy view editor
My page is not a result page. Is a "normal" page .
It's an archive page (city) in which I want to show only the professionals of this city using my view.
The code in your link doesn't work (maybe because I 'm using mapcenter with shorcode and not an url parameter?)
I would like the order to be defined by the mapcenter attribute.
Best thanks
My issue is resolved now. Thank you!
I found the same question here :
https://toolset.com/forums/topic/sorting-views-by-distance-to-current-post-geolocation/
And it works very good !!
Have nice day