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); } ?> </div> <?php } } ?> <?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_subproduct', $wpshop_display_option['wpshop_display_cat_sheet_output'])) { if (count(wpshop_categories::get_product_of_category($wp_query->queried_object->term_taxonomy_id)) > 0) { $category_has_content = true; $category_has_sub_content = true; echo do_shortcode('[wpshop_products cid="' . $wp_query->queried_object->term_id . '" type="' . $output_type . '"]');
/** * Traduit le shortcode et affiche une cat�gorie * @param array $atts : tableau de param�tre du shortcode * @return mixed **/ public static function wpshop_category_func($atts) { global $wpdb; $string = ''; if (!empty($atts['cid'])) { $atts['type'] = !empty($atts['type']) && in_array($atts['type'], array('grid', 'list')) ? $atts['type'] : 'grid'; $cat_list = explode(',', $atts['cid']); if (count($cat_list) > 1 || !empty($atts['display']) && $atts['display'] == 'only_cat') { $string .= ' <div class="wpshop_categories_' . $atts['type'] . '" >'; foreach ($cat_list as $cat_id) { $sub_category_def = get_term($cat_id, WPSHOP_NEWTYPE_IDENTIFIER_CATEGORIES); $string .= wpshop_categories::category_mini_output($sub_category_def, $atts['type']); } $string .= ' </div>'; } else { $sub_category_def = get_term($atts['cid'], WPSHOP_NEWTYPE_IDENTIFIER_CATEGORIES); if (empty($atts['display']) || $atts['display'] != 'only_products') { $string .= wpshop_categories::category_mini_output($sub_category_def, $atts['type']); $string .= ' <div class="category_product_' . $atts['type'] . '" > <h2 class="category_content_part_title" >' . __('Category\'s product list', 'wpshop') . '</h2>'; } $string .= wpshop_products::wpshop_products_func($atts); if (empty($atts['display']) || $atts['display'] != 'only_products') { $string .= '</div>'; } } } else { $string .= __('No categories found for display', 'wpshop'); } return do_shortcode($string); }