Forum: Nearby Posts

This forum is closed for new topics. However, you can still search for a solution in the old topics. For technical support related to the Nearby Posts premium extension please open a new premium support ticket.

[Resolved]Nearby Location not working if Current Location not set

Forums Nearby Posts Nearby Location not working if Current Location not set

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #49671
    jonathan
    Member

    Hi,

    I am using the Nearby Locations (Version 1.1-beta-2). I noticed that if the user doesn’t allow the browser to share their current location then the Nearby Locations doesn’t work. Currently, I want to only display (one) the location closest to me (the user) but is returning every single post in DESC order. In the shortcode I used (results_count=”1″) but is not working. How can I determine to show the Nearby Locations only if a current location is set. For example:

    IF current location is set then SHOW [gmw_nearby_locations nearby=”user” results_count=”1″] ELSE dont do anything

    How can I get this logic to work?

    Thank you very much in advanced.
    Jonathan

    #49673

    HI Jonathan,
    By default, the shortcode will display random locations if no nearby locations were found. You can disable the random locations using the attribute show_random_locations=”0″. By doing that, only nearby locations will be displayed, if found.

    Let me know if that works.

    #49686
    jonathan
    Member

    Hi Eyal,

    Thank you very much for your answer. This worked perfectly!… however, I have a couple of questions.

    1) If no nearby locations were found, is it possible to limit the random results by using (results_count=”1″). Right now this is returning all the posts.

    2) Is it possible to use a conditional statement for when the plugin/browser could not find the user’s location to be able to show the “Current Location” form so the user can set their location?

    Something like this?:
    (IF) user’s location is not found (DISPLAY) Current Location Form

    Thank you very much,
    Jonathan

    #49699

    You are welcome Jonathan.

    1) If no nearby locations were found, is it possible to limit the random results by using (results_count=”1″). Right now this is returning all the posts.

    This might be a bug, I am looking into it.

    2) Is it possible to use a conditional statement for when the plugin/browser could not find the user’s location to be able to show the “Current Location” form so the user can set their location?

    That is exactly what the “Current Location” shortcode/widget suppose to do. have you try using it?

    #49707
    jonathan
    Member

    Hi Eyal,

    Yes, I see it working! I see that when the user enters their location the form gets hidden.

    Thank you so much for your help! congrats on the plugin, its a very useful and well developed tool!

    – Jonathan

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.