Home › Toolset Professional Support › [Resolved] Show or Hide content on geolocation.
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/Karachi (GMT+05:00)
Tagged: Types plugin, Views plugin
This topic contains 4 replies, has 2 voices.
Last updated by Himanshu Agarwal 5 years, 7 months ago.
Assisted by: Waqar.
Hi,
I need to hide some content on a page based on Geo-location. Is this possible by toolset?
I mean, if I define a hide condition on content for country India then, No user from India is able to see that content.
Please help, how could we achieve this with toolset.
Hi Himanshu,
Thank you for contacting us and I'll be happy to assist.
The Toolset Maps plugin offers "wpv-geolocation" shortcode, which can get visitor's location from the browser, after user's consent:
https://toolset.com/documentation/user-guides/maps-shortcodes/#wpv-geolocation
That information can then be used with another shortcode "toolset-maps-distance-conditional-display" which conditionally shows or hides the content:
https://toolset.com/documentation/user-guides/maps-shortcodes/#toolset-maps-distance-conditional-display
Example:
[wpv-geolocation] [toolset-maps-distance-conditional-display location='India' distance='1000' display="inside" unit='mi'] Show content to visitor who is inside the 1000 miles radius from India's central location. [/toolset-maps-distance-conditional-display] [/wpv-geolocation]
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
I added shortcode that you given me:-
[wpv-geolocation] [toolset-maps-distance-conditional-display location='India' distance='1000' display="inside" unit='mi'] Show content to visitor who is inside the 1000 miles radius from India's central location. [/toolset-maps-distance-conditional-display] [/wpv-geolocation]
But this showing me this message:-
We need your location to show this content
How to solve this?
And could we pass multiple location in the shortcode? Like:-
[wpv-geolocation] [toolset-maps-distance-conditional-display location='India,Nepal,China' distance='1000' display="inside" unit='mi'] Show content to visitor who is inside the 1000 miles radius from India's central location. [/toolset-maps-distance-conditional-display] [/wpv-geolocation]
Hi Himanshu,
When the "[wpv-geolocation]" shortcode is used, "Your location is needed to show this content." message is shown, until the visitor agrees to share location information.
The following screenshots show how this consent dialog appears in different browsers:
Chrome: hidden link
Firefox: hidden link
Internet Explorer: hidden link
Also, the [toolset-maps-distance-conditional-display] shortcode only supports one location at a time and you can't add multiple locations in a single instance.
In case you feel these built-in shortcodes are not what your project requires, you can also check out third-party solutions from the following resources:
hidden link
hidden link
https://wordpress.org/plugins/geoip-detect/
https://wordpress.org/plugins/tags/geoip/
For more personalized assistance around custom code, you can also consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/
regards,
Waqar
Thank you!