Hi there,
My site provides activity listings with multiple categories, I would like to have some preset search that user can browse by, for example: tennis activities near you, basketball activities near you, etc. I know how to find the link to a category/activity, but how do i make sure it only show activities close to the user’s location?
For example here is one of my query string: ?_sort=&s=&post_type=hp_listing&latitude=&longitude=&_region=&location=&adventure_activities%5B%5D=377&adventure_activities%5B%5D=218&adventure_activities%5B%5D=374&adventure_activities%5B%5D=215&adventure_activities%5B%5D=216&adventure_activities%5B%5D=220&adventure_activities%5B%5D=221&adventure_activities%5B%5D=217&adventure_activities%5B%5D=219
latitude=&longitude=&_region=&location= have no value, how do I make sure it show listings close to the user who is currently visiting the site?
Thanks for the details. You can enable the radius search feature in HivePress > Settings > Geolocation, and then the closest listings will be searched for.
Please note that this feature is already enabled. You need to enter any address specified in any of your listing in the Location field, and then you will see this listing and the closest listings to this address. Also, on the left sidebar, you will see the Radius filter, which you can change. However, please note that the Generate regions from the locations feature is enabled, which means that the search will be performed by region. If you disable this feature, the search will be performed by radius.
Thanks Andrii! However, I think there is a misunderstanding on what I am trying to achieve. I would like to have pre-populated links my site that automatically takes the current user location into account.
For example the link would be: tennis activities near me and this would take user to this pre-populated link:
/?_sort=&s=&post_type=hp_listing&latitude=&longitude=&_region=&location=&sports_adventure_acti%5B%5D=237
But as you can see from the link, latitude, longitude, _region and location have no values, so how does such a link take current location into consideration?
If you mean to filter by user location immediately after redirection, unfortunately there is no simple way to do this, because browsers now ask for permission to share location (i.e., after clicking Locate Me, a window will appear where you must confirm or decline to share your location). As an alternative, it is possible to add auto-click (i.e., automatically confirm permission), but this would require advanced customization. In this version, you simply need to click on Locate Me and grant access, then the user will search for their location.