" > <a class="widget_category_title" href="<?php echo $link; ?> " ><span><?php echo esc_html($category->name); ?> </span></a> <?php if ($category_state_class != 'wpshop_category_empty') { ?> <ul class="wpshop_categories_widget <?php echo $category_class; ?> " id="wpshop_categories_widget_<?php echo $category->term_id; ?> " > <?php echo wpshop_categories::category_tree_output($category->term_id, $instance); /* Get the product of the current category if the current category has no sub category*/ global $category_has_sub_category; if (!$category_has_sub_category && $display_product == 'yes') { wpshop_products::get_product_of_category($category->slug, $category->term_id); } ?> </ul> <?php } ?> </li>
/** * Widget Output * * @param array $args * @param array $instance Widget values. */ function widget($args, $instance) { $widget_content = ''; /* Get the default args from wordpress */ extract($args); /* Get the widget title from the admin configuration */ $title = apply_filters('widget_title', empty($instance['title']) && $instance['title'] != 'vide' ? __('Catalog', 'wpshop') : ($instance['title'] == 'vide' ? ' ' : $instance['title'])); /* Get the widget's content */ $widget_content = '<ul class="main_cat_tree_widget" >' . wpshop_categories::category_tree_output(0, $instance) . '</ul>'; /* Add the different element to the widget */ $widget_content = $before_widget . $before_title . $title . $after_title . $widget_content . $after_widget; echo $widget_content; }