Merge pull request #596 from pixeltrix/dont-output-child-cat-wrapper

Don't output the subcategory wrapper if there are no subcategories
This commit is contained in:
Mike Jolley 2012-02-08 02:25:52 -08:00
commit 1dd988075a
1 changed files with 7 additions and 5 deletions

View File

@ -119,13 +119,15 @@ class WooCommerce_Widget_Product_Categories extends WP_Widget {
$subcat_args['child_of'] = $cat->term_id;
$subcat_args['hierarchical'] = 1;
$subcat_args['show_option_none'] = false;
$subcat_args['echo'] = false;
unset( $subcat_args['parent'] );
echo '<ul class="children">';
wp_list_categories(apply_filters('woocommerce_product_categories_widget_args', $subcat_args));
echo '</ul>';
$subcategories = wp_list_categories(apply_filters('woocommerce_product_categories_widget_args', $subcat_args));
if ($subcategories) {
echo '<ul class="children">';
echo $subcategories;
echo '</ul>';
}
endif;