Supreme Directory Locations / Near Me Question
This topic contains 15 replies, has 3 voices, and was last updated by Paolo 7 years, 10 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: geolocation, homepage, location, near me
-
AuthorPosts
-
January 31, 2017 at 5:59 am #352262
When a user on my website selects a location, i.e. a region for which I have set a description and an image it will set this as their homepage and that’s awesome. What I noticed is that if the user gets geolocated with the popup, it will not load the image from the location that they are in and will instead load the default header image (in my case I have only set regions and not cities). I would like it if someone living in, say, Ontario would get shown the location page for ontario after they have been geolocated with the popup or “near me” button. Is this possible? It would be asking a lot for it to pull city locations after being geolocated, since it would have to pull closest locations to the user, but if I stick with just regions then this should work really well.
powerlily.io
January 31, 2017 at 5:16 pm #352719Hi,
that’s not possible, because GeoLocation locates them in the precise point where they are.
yoursite/location/me/
while the image is attached to a specific region
yoursite/location/canada/ontario for example.
Thanks
January 31, 2017 at 5:41 pm #352733Okay, that’s no problem. Would it be possible to set a default image for the near me page that is different than the “featured image” that gets used by default for all pages with supreme directory? This would be fine because I could use an image of a person using a map or whatever to convey the right message, but said image probably wouldn’t go well as the default featured image for all pages. Is this possible?
Thanks.
January 31, 2017 at 5:52 pm #352734Hi,
I asked to the developers to let us know if that’s possible.
They’ll let us know asap.
Thanks
January 31, 2017 at 5:56 pm #352735Thanks Paolo,
January 31, 2017 at 6:54 pm #352784Hi Tom,
I have added a filter to modify banner.
Please post your ftp details. I’ll apply the changes.
Once I apply the changes you can use the following code in code snippets to modify the thumbnail.
add_filter('sd_featured_image_url', 'modify_near_me_banner'); function modify_near_me_banner($banner_url) { global gd_session; if (($gd_session->get('my_location') || ($gd_session->get('user_lat') && $gd_session->get('user_lon')))) { $banner_url = "image url here"; } return $banner_url; }
January 31, 2017 at 6:57 pm #352786This reply has been marked as private.January 31, 2017 at 7:22 pm #352801I’ve added this snippet.
add_filter(‘sd_featured_image_url’, ‘modify_near_me_banner’);
function modify_near_me_banner($banner_url) {
global gd_session;
if (($gd_session->get(‘my_location’) || ($gd_session->get(‘user_lat’) && $gd_session->get(‘user_lon’)))) {
$banner_url = “https://powerlily.io/wp-content/uploads/2017/01/nearme.jpg”;
}
return $banner_url;
}Let me know when you’ve done your thing and I’ll give it a try.
Thanks!
January 31, 2017 at 7:24 pm #352803Hi,
Giri is off for the night, he’ll apply the fix when he comes back online tomorrow morning (Indian time).
Thanks
January 31, 2017 at 7:24 pm #352804Okay, no problem. Cheers.
February 1, 2017 at 9:22 am #352991Hi Tom,
CPanel login not working for me.
Can you post your wp-admin login details as well?
Thanks
February 1, 2017 at 8:44 pm #353516This reply has been marked as private.February 2, 2017 at 11:26 am #353826This reply has been marked as private.February 2, 2017 at 5:48 pm #354047I’m a little bit confused. The near me button doesn’t seem to pull the banner that I set, however, when I click to be geolocated it is now pulling the banner and tagline (location) that is closest to me. I live in yarmouth NS and I have this set as a location, when I geolocated this popped up, which is awesome. To test it further I deleted Yarmouth as a location and tried again. This time it pulled Weymouth (the closest town to me that I have entered details for – awesome! and yes I know, lots of towns ending in mouth in NS).
So this could work if I make sure to have a lot of cities put in, I wouldn’t want someone geolocating and seeing a city that’s 100’s of miles away.
So, I’m not really sure if the code is working the way you intended, as it isn’t pulling the nearme.jpg I set, however, it is pulling the user to the closest city, which might be even better! I don’t know. I’ll keep playing with it.
Let me know your thoughts.
February 2, 2017 at 6:02 pm #354051If I could get it to work the way it works right now (pulling locations when the user clicks the geolocate popup) but it pulled the region that the user was in instead of the closest city, this would be ideal. It’s current state is great but it would mean that I’d have to add nearly every city in North America. If you try the geolocate popup on the site from where you are, it will probably pull a location that is a long way away i.e. the closest location to you that I have put in, can you test this? Alternatively if I put in just every state and province in North America and this info was pulled when a user geolocates it would save me a lot of time and still function great for the users.
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket