</div> <div class="category-description alignleft"> <?php echo do_shortcode(nl2br($wp_query->queried_object->description)); ?> </div> </div> <?php } ?> <div class="wpshop_clear wpshop_category_content" > <?php /* Check what must be outputed on the page (Defined in plugin option) */ if (!is_array($wpshop_display_option['wpshop_display_cat_sheet_output']) || in_array('category_subcategory', $wpshop_display_option['wpshop_display_cat_sheet_output'])) { $category_tree = wpshop_categories::category_tree($wp_query->queried_object->term_id); if (is_array($category_tree) && count($category_tree) > 0) { $category_has_content = true; $category_has_sub_content = true; ?> <!-- Start category content display --> <div class="category_subcategories_list" > <h2 class="category_content_part_title" ><?php _e('Category\'s sub-category list', 'wpshop'); ?> </h2> <?php foreach ($category_tree as $sub_category_id => $sub_category_content) { $sub_category_definition = get_term($sub_category_id, WPSHOP_NEWTYPE_IDENTIFIER_CATEGORIES); echo wpshop_categories::category_mini_output($sub_category_definition, $output_type); }
/** * Get the sub categories of a given category * * @param integer $parent_category The main category we want to have the sub categories for * @param array $instance The current instance of the widget, allows to get the different selected parameters * * @return mixed $widget_content The widget content build from option */ public static function category_tree_output($category_id = 0, $instance) { global $category_has_sub_category; $widget_content = ''; $category_tree = wpshop_categories::category_tree($category_id); if (!isset($instance['wpshop_widget_categories']) && !isset($instance['show_all_cat']) || $instance['show_all_cat'] == 'yes') { $categories = get_terms(WPSHOP_NEWTYPE_IDENTIFIER_CATEGORIES, 'hide_empty=0&parent=' . $category_id); if (count($categories) > 0) { foreach ($categories as $category) { ob_start(); require wpshop_display::get_template_file('categories-widget.tpl.php'); $widget_content .= ob_get_contents(); ob_end_clean(); } $category_has_sub_category = true; } else { $category_has_sub_category = false; } } return $widget_content; }