adyp

Forum Replies Created

Viewing 15 posts - 91 through 105 (of 475 total)
  • Author
    Posts
  • in reply to: the …/me location page (from Near Me button) #389568

    adyp
    Expired Member
    Post count: 496

    Thanks Kiran,

    I will give it a go and report back!
    Adrian

    in reply to: the …/me location page (from Near Me button) #389561

    adyp
    Expired Member
    Post count: 496

    Thanks Kiran. Just to make sure I understand this:

    if I put the following in functions.php (or as a snippet with Code Snippet plugin):

    
    
    $location_terms = geodir_get_current_location_terms();
    
    // /united-kingdom/ (country)
    if ( !empty( $location_terms['gd_country'] ) && $location_terms['gd_country'] == 'united-kingdom' ) {
        // True
    }
    
    // /australia/ (country)
    if ( !empty( $location_terms['gd_country'] ) && $location_terms['gd_country'] == 'australia' ) {
        // True
    }

    Then use the following Widget Logic in a widget settings (from GD guidance page on Widget Logic):

    strtolower(geodir_get_current_location(array('echo' => false)))==strtolower('united-kingdom')

    or

    in_array('united-kingdom', geodir_get_current_location_terms('query_vars'))


    The widget will be displayed if the user is geolocated in UK…

    Then use the following Widget Logic in a widget settings (from GD guidance page on Widget Logic):

    strtolower(geodir_get_current_location(array('echo' => false)))==strtolower('australia')

    or

    in_array('australia', geodir_get_current_location_terms('query_vars'))

    The widget will be displayed if the user is geolocated in Australia?

    And so on – i.e., for each country that I wish to use geolocation data to present a widget I have to add the php snippet to functions.php and then use the appropriate settings in Widget Logic?

    (…if I can identify which widget section/page to put the widget on!)

    Is that the way to achieve it?

    Thanks,
    Adrian

    in reply to: Use geolocation data to determine widget visibility? #389456

    adyp
    Expired Member
    Post count: 496

    OK – I spoke too soon – the slider I wanted to see was appearing as I had identified the wrong (right) slider in the widget control, not because the widget logic was correct. Things stand as when I started the thread: I need to have some code to put in widget logic that will allow me to show a widget based on the geolocated value (ideally country) as opposed to value selected for location in location selector – I think they are different, based on behaviour I observe, neither the two snippets in GD Widget Logic documentation for will do that! Is there another function/piece of code that I can use?

    Sorry for premature assessment that it was resolved … off to have a lie down for 5 mins!

    in reply to: Use geolocation data to determine widget visibility? #389430

    adyp
    Expired Member
    Post count: 496

    The code I used (and which worked) is very similar – not sure if the final brackets make a difference!:

    strtolower(geodir_get_current_location(array(‘echo’ => false)))==strtolower(”)

    I think all is resolved with this thread – thanks very much!

    in reply to: Use geolocation data to determine widget visibility? #389427

    adyp
    Expired Member
    Post count: 496

    Apologies,

    the code I referenced two posts up is returning the geolocated country just fine in non-gd pages – so that is fine.

    thanks for all your help with this!
    Adrian

    in reply to: Use geolocation data to determine widget visibility? #389408

    adyp
    Expired Member
    Post count: 496

    Thanks Giri,

    we must have been typing at the same time!

    Any ideas about the Geolocation setting?

    in reply to: Use geolocation data to determine widget visibility? #389407

    adyp
    Expired Member
    Post count: 496

    I have been testing the various snippets of widget logic set here: https://wpgeodirectory.com/docs/useful-plugins/#logic

    and adapting the second (location) snippet for the UK :

    strtolower(geodir_get_current_location(array(‘echo’ => false)))==strtolower(‘united-kingdom’)

    this shows the widget if the Location Selector is used to select UK or any region or city in UK – so-far so-good – but I would like to use the geolocation data to set widgets, especially for non-GD pages when the viewer has been geolocated – and also for the GD home page and the /location page when ‘Everywhere’ has been selected – the fact that the map shows the geolocation beacon when navigating via non-GD pages to the GD home page and ‘Everywhere’ page shows the data is stored somewhere – I’d just like to know how to use this to put in Widget Logic.

    Thanks

    (also, still be good to know code to use in widget logic when no geolocation, no location has been selected – or ‘everywhere’ is selected after a location had been)

    in reply to: Automatic location descriptions #389336

    adyp
    Expired Member
    Post count: 496

    Ok- in that case it might be better for me to write separate seo-optimised pages for each main location and then have each linking to the appropriate auto-generated location page (and consider linking a canonical that way too, i.e., to the auto page – I’ll have to mull over the implications of that though)

    You can mark this resolved now – thanks.

    in reply to: Use geolocation data to determine widget visibility? #389274

    adyp
    Expired Member
    Post count: 496

    Yes that works fine thanks – I can’t see much difference from the guidance page that I cut and paste from – have you changed that page on the GD website too, or should I be wary of cut and paste from that?

    The only other thing I am waiting on is something I asked about in this thread above: how to use the logic to set a widget when NO location has been selected – or ‘everywhere’ is selected after a location had been – is there a way to do that?

    Thanks,
    Adrian

    in reply to: Use geolocation data to determine widget visibility? #389271

    adyp
    Expired Member
    Post count: 496

    I am not sure what you mean – can you please clarify: what must I do differently?!

    in reply to: Automatic location descriptions #389270

    adyp
    Expired Member
    Post count: 496

    Hi,

    From an SEO point of view I was hoping it would work: not having the same description for each location, but the same information about using the directory, with the location changed automatically – though I believe that would only work if I had (automatic) canonical links to more bespoke pages about particular locations (e.g. canonical from …/location/united-kingdom to …/organic-united-kingdom).

    Maybe I will focus on a few key locations for seo purposes and do it manually. This leads to the question: is it possible to set canonical links on the auto-generated location pages (I am using Yoast if that makes a difference)?

    Thanks,
    Adrian

    in reply to: Use geolocation data to determine widget visibility? #389170

    adyp
    Expired Member
    Post count: 496
    This reply has been marked as private.
    in reply to: Use geolocation data to determine widget visibility? #389161

    adyp
    Expired Member
    Post count: 496
    This reply has been marked as private.
    in reply to: Use geolocation data to determine widget visibility? #389160

    adyp
    Expired Member
    Post count: 496

    I have tried using the logic on the page linked to by Guust, above, but with no luck (substituting ‘australia’ for the other locations in each case), e.g.,:

    strtolower(geodir_get_current_location(array(‘echo’ => false)))==strtolower(‘australia’)

    and

    in_array(‘australia’, geodir_get_current_location_terms(‘query_vars’))

    In fact, the first of these just prints ‘australia’ at several places all over the page! Am I doing something wrong, or is the logic code wrong?

    login to follow …

    in reply to: Use geolocation data to determine widget visibility? #389107

    adyp
    Expired Member
    Post count: 496

    Thanks Guust,

    I had missed that documentation somehow when looking for info. I will have a play around with that logic as it is different from what I was using – especially since I have had a problem in that once set to a country, the widgets don’t appear to want to change back to everywhere or to another location. Not sure if it is a cache issue, session issue, Widget Login setting of something else, so I will experiment.

    It would still be good to know the answer to my q1 above (logic to use if no location selected).

    Thanks,
    Adrian

Viewing 15 posts - 91 through 105 (of 475 total)
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount