/** * Outputs the HTML for this widget. * * @param array An array of standard parameters for widgets in this theme * @param array An array of settings for this widget instance * * @return void Echoes it's output */ function widget($args, $instance) { extract($args, EXTR_SKIP); $title = apply_filters('widget_title', $instance['title']); $limit = absint($instance['count']) ? absint($instance['count']) : 10; $seller = dokan_get_best_sellers($limit); echo $before_widget; if (!empty($title)) { echo $args['before_title'] . $title . $args['after_title']; } dokan_get_template_part('widgets/best-seller', '', array('pro' => true, 'seller' => $seller)); echo $after_widget; }
/** * Outputs the HTML for this widget. * * @param array An array of standard parameters for widgets in this theme * @param array An array of settings for this widget instance * @return void Echoes it's output **/ function widget($args, $instance) { extract($args, EXTR_SKIP); $title = apply_filters('widget_title', $instance['title']); $limit = absint($instance['count']) ? absint($instance['count']) : 10; $seller = dokan_get_best_sellers($limit); echo $before_widget; if (!empty($title)) { echo $args['before_title'] . $title . $args['after_title']; } ?> <ul class="dokan-best-sellers"> <?php if ($seller) { foreach ($seller as $key => $value) { $rating = dokan_get_seller_rating($value->seller_id); $display_rating = $rating['rating']; if (!$rating['count']) { $display_rating = __('No ratings found yet!', 'dokan'); } ?> <li> <a href="<?php echo dokan_get_store_url($value->seller_id); ?> "> <?php echo $value->display_name; ?> </a><br /> <i class='fa fa-star'></i> <?php echo $display_rating; ?> </li> <?php } } ?> </ul> <?php echo $after_widget; }