Supreme Directory Locations / Near Me Question

This topic contains 15 replies, has 3 voices, and was last updated by  Paolo 7 years, 2 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #352262

    Tom Rendle
    Buyer
    Post count: 46

    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

    #352719

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    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

    #352733

    Tom Rendle
    Buyer
    Post count: 46

    Okay, 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.

    #352734

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    I asked to the developers to let us know if that’s possible.

    They’ll let us know asap.

    Thanks

    #352735

    Tom Rendle
    Buyer
    Post count: 46

    Thanks Paolo,

    #352784

    Giri
    Expired Member
    Post count: 3155

    Hi 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;
    }
    #352786

    Tom Rendle
    Buyer
    Post count: 46
    This reply has been marked as private.
    #352801

    Tom Rendle
    Buyer
    Post count: 46

    I’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!

    #352803

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    Giri is off for the night, he’ll apply the fix when he comes back online tomorrow morning (Indian time).

    Thanks

    #352804

    Tom Rendle
    Buyer
    Post count: 46

    Okay, no problem. Cheers.

    #352991

    Giri
    Expired Member
    Post count: 3155

    Hi Tom,

    CPanel login not working for me.

    Can you post your wp-admin login details as well?

    Thanks

    #353516

    Tom Rendle
    Buyer
    Post count: 46
    This reply has been marked as private.
    #353826

    Giri
    Expired Member
    Post count: 3155
    This reply has been marked as private.
    #354047

    Tom Rendle
    Buyer
    Post count: 46

    I’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.

    #354051

    Tom Rendle
    Buyer
    Post count: 46

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

Viewing 15 posts - 1 through 15 (of 16 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket