Пример #1
0
 /**
  * Outputs the HTML for this widget.
  *
  * @param array  $args
  * @param array  $instance [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;
     $sellers = dokan_get_feature_sellers($limit);
     echo $before_widget;
     if (!empty($title)) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     dokan_get_template_part('widgets/feature-seller', '', array('pro' => true, 'sellers' => $sellers));
     echo $after_widget;
 }
Пример #2
0
    /**
     * 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;
        $sellers = dokan_get_feature_sellers($limit);
        echo $before_widget;
        if (!empty($title)) {
            echo $args['before_title'] . $title . $args['after_title'];
        }
        ?>
        <ul class="dokan-feature-sellers">
            <?php 
        if ($sellers) {
            foreach ($sellers as $key => $seller) {
                $store_info = dokan_get_store_info($seller->ID);
                $rating = dokan_get_seller_rating($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($seller->ID);
                ?>
">
                            <?php 
                echo esc_html($store_info['store_name']);
                ?>
                        </a><br />
                        <i class='fa fa-star'></i>
                        <?php 
                echo $display_rating;
                ?>
                    </li>

                    <?php 
            }
        }
        ?>
        </ul>
        <?php 
        echo $after_widget;
    }