Is there a way to output a list of views based on the visitor's location?
When you visit the map page, you want to automatically print information of institutions within 3km of the visitor's location and print it on the map.
How can there be a way?
Hello and thank you for contacting the Toolset support.
That is totally possible, but it requires three steps:
- The website needs to be served over SSL. Otherwise, the browser will not ask the user for the location permissions.
- A query filter to ensure that the post will be queried based on their distance from the user location. That's what you have add in the screenshot 3_6.png
- Force the visitor browser to ask for the current user location, and reload the view using it. This will require that you add the following shortcodes inside the view(either inside the loop, or inside the search filters):
[wpv-geolocation]
[/wpv-geolocation]
Read more about the shortcode here https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#wpv-geolocation
I would suspect that the 3rd steps is the one that is missing on your setup right now. If that does not help, allow me temporary access to your website and I'll check this closely. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **
Thank you so much. Mr. Jamal.
I have additional questions. Is there a way to display the markers in the order closest to the visitor's location?
Please, reply.
I assume you mean that if there is a way to order the view's results based on their distance from the user's location, right?
Yes, that's possible. You can configure the view's order based on the distance from the user's location. However, this feature is not possible yet with the blocks-based views. You will need to create the view with the legacy editor.
Hi, Mr.Jamal.
Any idea how to implement it?
Would you allow me temporary access to your website? I'll prepare an example for you and the steps to achieve it with screenshot.
Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **
Please let me know the following:
- What is the Address field that you want to use?
- What post type that you want to use?