Hello,
in our setup we use category hierarchy for a better structure, too, most entries are not linked to a parent category, but to subcategory only. On the map’s category list we need the total count for parent categories, including subcategories. So we changed the function geodir_filter_empty_terms() in geodirectory-functions/general_functions.php lines 4786-4798. Maybe you are interested in this code, too.
Dear developers, we would be very glad if you implement this code into the next version. Otherwise could you please add a hook that we can modify it without hacking the code?
function geodir_filter_empty_terms($terms) {
if (empty($terms)) {
return $terms;
}
$return = array();
foreach ($terms as $term) {
if (isset($term->count) && $term->count > 0) {
$return[] = $term;
}
else if(!empty($term)) {
$count = 0;
$taxonomy = $term->taxonomy;
$args = array(
'child_of' => $term->term_id,
);
$tax_terms = get_terms($taxonomy,$args);
foreach ($tax_terms as $tax_term) {
if( $tax_term->count > 0) {
$return[] = $term;
break;
}
}
}
}
return $return;
}
Suggestion for a filter hook:
...
else if(!empty($term)) {
$return = apply_filters( 'geodir_filter_empty_terms_filter', $term);
}