June 1, 2016 at 12:10 pm #52558
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.June 2, 2016 at 3:26 am #52570
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.June 2, 2016 at 5:25 pm #52577
Hello Josh and thank you for the purchase.
The Nearby Posts on the demo page were created using this simple shortcode:1[gmw_nearby_locations item_type="posts" nearby="user" radius="9999999"]
Have you seen this documentation page where you can find a complete shortcode guide?June 2, 2016 at 5:29 pm #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.June 3, 2016 at 3:18 am #52585
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.June 3, 2016 at 4:21 am #52587
I’m sorry for all the edits and following up…
I think I got the single-nearest location thing figured out.June 3, 2016 at 5:28 am #52589
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.June 4, 2016 at 9:35 pm #52613
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
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:123456<!-- directions --><?php if ( $directions ) : ?><div class="gmw-nbp-directions-wrapper"><i class="fa fa-location-arrow"></i><?php echo $directions; ?></div><?php endif; ?>
with this code.
Let me know if that helps.June 6, 2016 at 3:57 am #52627
Yes, thank you! This helps a lot 🙂 I greatly appreciate all of your assistance!June 6, 2016 at 10:08 am #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,June 6, 2016 at 5:31 pm #52641Ariel LevyMember
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.
ArielJune 7, 2016 at 3:53 am #52644
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.
You must be logged in to reply to this topic.