October 17, 2015 at 7:32 am #46738
I have 10 categories that a post can be assigned to. What I’d like a user to see is a list of all posts X miles from user’s current location that have a category ID of 2. No other posts should be in the list.
Here’s the shortcode I’m using, but it’s not working as I would expect:
[gmw_nearby_locations item_type=”posts” post_types=”post” include_terms=”2″]
Any insight would be appreciated. Thanks!October 17, 2015 at 9:13 am #46739
using exclude_terms like this DOES work: [gmw_nearby_locations item_type=”posts” post_types=”post” exclude_terms=”1,3,4,5,6,7,8,9,10,11″]
The problem is that when there are NO posts with a CAT ID=2, all of the posts are returned. I would expect no results. Could this be a bug? Any hotfix I can apply to get it to work?
Also, I do not want to have the map showing, but do want the list. Using show_map=”false” or 0/no does not remove the map, instead I am getting this error: “Notice: Undefined variable: map_output in /home/getsno5/public_html/wp-content/plugins/gmw-nearby-locations/templates/posts/lightcoral/content-start.php on line 2”October 21, 2015 at 4:14 pm #47120
I was able to solve this by a combination of GeoMyWP core Post Locator search form and the info from this support post on wordpress.org, https://wordpress.org/support/topic/im-guessing-this-can-not-display-maps-of-posts-in-categories.
BUT, When there are no results returned, the screen is blank – no message to tell people that the search was executed, but no results found. I’m using a cloned version of the Default results template. How could I go about adding that functionality?October 21, 2015 at 10:34 pm #47138
I apologize for missing out your initial post.
I am going to look into the include_terms and the show_map functions to see if its a bug. Meanwhile, please add the attribute show_random_locations=”0″ to the shortcode and see if it prevents the plugin from showing locations when there are no results.
Thanks,October 22, 2015 at 3:44 am #47159
Thank you, Eyal. I will try that idea for Nearby Locations and let you know the results.
I like the control of using Post Locator search result custom results template, so I’ll probably stick to that as the final solution. When there are no results returned from the automatic search I have set up, how can I create a “no results” message on the page? I would take code from the other default templates you have, but those also are not returning a “no results” message.October 24, 2015 at 5:44 pm #47345
I uploaded a new beta version ( beta 2 ) which should take care of the include_terms issue. You can download it from Your Account page.
I like the control of using Post Locator search result custom results template, so I’ll probably stick to that as the final solution.
You can use custom results with Nearby Locations as well. All you need to do is copy the results folder that you want from “gmw-nearby-locations/templates/posts” into your “theme or child theme folder/geo-my-wp/nearby-locations/posts/” and the plugin will pick it up from there.
As for the Posts Locator form, the plugin is not meant to display “No Results” message when using the “Page Load Results” tab but only when submitting a search form. To go around that you will most likely need to edit core files.November 7, 2015 at 7:10 pm #48772
This topic marked “Resolved” due to inactivity. If you wish to reply to this topic please change its status to “Not resolved” before replying.
You must be logged in to reply to this topic.