/** * 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); }