Skip Navigation

[Closed] Is there a way to output a list of views based on the visitor's location?

This support ticket is created 3 years, 1 month 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: Africa/Casablanca (GMT+01:00)

This topic contains 5 replies, has 2 voices.

Last updated by Jamal 3 years, 1 month ago.

Assisted by: Jamal.

Author
Posts
#2220977
6.png
5.png
4.png
3.png

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?

#2221209

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. **

#2221851

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.

#2222095

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.

#2223073

Hi, Mr.Jamal.
Any idea how to implement it?

#2223107

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?

The topic ‘[Closed] Is there a way to output a list of views based on the visitor's location?’ is closed to new replies.