Modify Popular Widget – don't display if no listings

This topic contains 3 replies, has 2 voices, and was last updated by  Stiofan O’Connor 7 years, 6 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #294472

    Craig Fryer
    Expired Member
    Post count: 110

    Problem:
    On location pages I have used the GeoDirectory Popular Widget for custom post types. This works fine as long as there are listing for that category of the custom post type for that location. The problem is when there are no listings meeting the criteria. Then there is a widget output on the page with “No listings found which match your selection”.

    See example where there are no listings for “Districts”.
    https://www.gojapango.com/location/hiroshima-prefecture/hiroshima/

    Now not only does this not look particularly good, it causes problems with search engine results in Google. Having an empty listing creates a page with no meaningful information on it.
    https://www.gojapango.com/places/hiroshima-prefecture/hiroshima/attractions/ (district/) remove space and brackets for correct link.

    The problem is Google sees this sort of page a soft 404 page. Google says this shouldn’t be a problem, but it isn’t really good having hundreds of these pages on a site. In the end the domain starts to look like it has problems or lacks useful information.

    Request
    Modify the code (assume it is in the geodirectory_popular_widget.php file) to check first if the number of listings is greater than 1. If not then don’t output anything.

    I would need to know what code is modified so that I can re-insert the code when the php file is updated.

    #295582

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hello,

    I am not sure removing the whole widget is the best idea, maybe just removing the view all link would suffice?

    Stiofan

    #295591

    Craig Fryer
    Expired Member
    Post count: 110

    I think it would look a bit strange with the heading for the custom post type and then nothing after it.

    #295608

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    It would just be:
    Districts
    No listings found which match your selection.

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

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket