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]Having trouble with Nearby Posts loop

Forums Nearby Posts Having trouble with Nearby Posts loop

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #52558
    Josh Carey
    Member

    Hi there, I’m scratching my head, but I can’t for the life of me figure out what I’m doing wrong.

    Basically, I have two areas that I need to incorporate results for Nearby Posts.

    Here’s a screenshot of the desired result:

    I’ve setup a page called “Locations”. I’ve setup a custom post type (with the slug “locations-list”). I’ve created a post in that post type, added some content, defined the location address, published the post.

    I can’t get any shortcode to display that post. All I’m seeing on my page is the shortcode(s) printed out. No actual post data is being displayed in place of the shortcode.

    Like I said, I’m looking to display just that post, but rather some, or all of them – then that list would expand based on publishing new “location” posts.

    I’m assuming I don’t need a “form” setup, as I’m not trying to do any searching yet at this point… merely trying to display the list of all the location posts.

    Also, if it helps – I’m physically located in Tampa, FL – and the first and only location is up in Jacksonville, FL – so its not really close.

    Attachments:
    You must be logged in to view attached files.
    #52570
    Josh Carey
    Member

    If its possible, would you please provide a list of steps it took to create the demo page: http://demo.tempform.wpengine.com/nearby-posts-location/

    I feel like this gets me most of the way to where I need to be. We’re not really wanting a map (as per the previous screenshot), but rather just a list of nearby location posts (I’ll need to pull the title, some custom fields, and the featured image). Then the top section would need the closest location to the user, where I obviously pull the same info, but its just in a different visual layout.

    #52577

    Hello Josh and thank you for the purchase.

    The Nearby Posts on the demo page were created using this simple shortcode:

    Have you seen this documentation page where you can find a complete shortcode guide?

    #52578

    My apologies, I think I know what the issues is.

    If the shortcode is not being generated and all you see is the shortcode as text, I assume that you are using version 1.0.2 of the plugin. If that is the case, please navigate to your account page, download version 1.1 beta 3 and manually install it on your site ( make sure to first delete version 1.0 from your site ) . Version 1.1 should work based on the documentation page I posted above. It is marked as a beta but it is a stable version and can be used on a production site.

    Let me know if that helps.

    #52585
    Josh Carey
    Member

    Hi Eyal,

    Thanks so much for getting back to me. After updating the plugin add-on, it did fix the broken shortcode. I’m now seeing the list of locations just fine.

    Basically what I’m needing now is just the single nearest location to the user (like that top light-gray section in the screenshot). Is there a shortcode that can make that work? I can see that when I add ‘results_count=”1″‘, it only returns 1 result, but it seems to be random, as its not choosing the nearest location to me – every time I refresh, I get a different location.

    Also, will I be able to somehow manipulate the result to match the format in the screenshot? If its just a matter of tweaking the plugin content.php file, I can do that.

    #52587
    Josh Carey
    Member

    I’m sorry for all the edits and following up…

    I think I got the single-nearest location thing figured out.

    #52589
    Josh Carey
    Member

    I do have one question that you might be able to help with… Instead of a “get directions” link. I’m trying to figure out a way to change the link to simply open the location on a map in a new tab. Basically without the user’s current location, ONLY opening the location’s map in a new tab. Does this make sense? I don’t want to have to manually go to google maps, navigate to the location and copy the special “share link” provided by google.

    #52613

    Hi Josh,
    I am glad you got most of it working.

    Also, will I be able to somehow manipulate the result to match the format in the screenshot? If its just a matter of tweaking the plugin content.php file, I can do that.

    Yes, you can crete a custom results template file and place it in your theme’s folder. You should follow the steps below:
    1) in your theme/child theme’s folder create the folders /geo-my-wp/nearby-locations/posts/

    2) Open the plugin’s folder gmw-nearby-locations/templates/posts/ and copy one of the folders ( default, lightcoral or lightseagreen ) with all of its content and paste it in the ‘posts’ folder you created in your theme’s folder.

    3) Now, if you choose this folder name as the results template file in the nearby widget or shortcode, then the plugin should pick it up from the theme’s folder. And so you can edit the ‘content-single-item.php’ file as you wish.

    I’m trying to figure out a way to change the link to simply open the location on a map in a new tab. Basically without the user’s current location, ONLY opening the location’s map in a new tab. Does this make sense?

    Yes, it is possible. After creating the custom results template file as described above ( or editing the core template files of the plugin ), open the “content-single-item.php” file and replace:

    with this code.

    Let me know if that helps.

    #52627
    Josh Carey
    Member

    Hi Eyal,

    Yes, thank you! This helps a lot 🙂 I greatly appreciate all of your assistance!

    #52636

    You are welcome Josh, I am glad I could help.

    I mark this topic resolved. If you have further questions regarding the above please change the topic status to not resolved before replying.

    Thanks,

    #52641
    Ariel Levy
    Member

    Hi Josh,
    When you said earlier that “I think I got the single-nearest location thing figured out.” Can you tell me how you solved the issue? I am having a similar problem and cannot get the site to return the closest location. http://www.wingsbeachwear.com.
    Much Thx,
    Ariel

    #52644
    Josh Carey
    Member

    Hi Ariel,

    First off, I had to follow Eyal’s directions for updating the Nearby Posts plugin add-on to the latest version.

    But then basically, here’s the shortcode I used: (my custom post type is “location”, so you’d need to change that… I didn’t want to display a map in my case.)
    ‘[gmw_nearby_locations item_type=”posts” post_types=”location” show_map=”false” nearby=”user” radius=”999″ results_count=”1″ show_random=”false”]’

    Then my plugin settings:
    GEO my WP > Settings:
    Client-side Geocoder: checked
    Auto Locator: checked

    I think that’s all the magic there is to it…?

    The weird thing is though, the “show_random=”false” setting isn’t working for me, as for my current browser setting – I’m not allowing the site to see my location. So it IS just showing a random location on each page refresh. As soon as I allow my browser to view my location, then the site does grab the same “closest” location after each refresh. So for certain users who block browser location, this might be an issue, but time will tell.

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

You must be logged in to reply to this topic.