Allow showing of empty categories using 'hide_empty' param of get_categories()

This commit is contained in:
Daniel Espinoza 2014-02-24 11:57:06 -06:00 committed by Coen Jacobs
parent 1261e48bcc
commit 4907e1d02d
1 changed files with 5 additions and 2 deletions

View File

@ -1412,7 +1412,8 @@ if ( ! function_exists( 'woocommerce_product_subcategories' ) ) {
'taxonomy' => 'product_cat',
'pad_counts' => 1
);
$product_categories = get_categories( apply_filters( 'woocommerce_product_subcategories_args', $args ) );
$args = apply_filters( 'woocommerce_product_subcategories_args', $args );
$product_categories = get_categories( $args );
$product_category_found = false;
@ -1420,7 +1421,9 @@ if ( ! function_exists( 'woocommerce_product_subcategories' ) ) {
foreach ( $product_categories as $category ) {
if ( $category->parent != $parent_id || $category->count == 0 )
if ( $category->parent != $parent_id )
continue;
if ( $args['hide_empty'] && $category->count == 0 )
continue;
if ( ! $product_category_found ) {