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]How to show nearby locations posts with category ID 2 ?

Forums Nearby Posts How to show nearby locations posts with category ID 2 ?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #46738
    Ben
    Member

    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!

    #46739
    Ben
    Member

    UPDATE

    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”

    #47120
    Ben
    Member

    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?

    #47138

    Hi Ben,
    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,

    #47159
    Ben
    Member

    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.

    #47345

    Hi Ben,
    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.

    #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.

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

You must be logged in to reply to this topic.