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.