/**
  * Front-end display of widget.
  *
  * @see WP_Widget::widget()
  *
  * @param array $args     Widget arguments.
  * @param array $instance Saved values from database.
  */
 public function widget($args, $instance)
 {
     $title = apply_filters('widget_title', $instance['title']);
     extract($instance);
     $r = dokan_get_top_rated_products($no_of_product);
     echo $args['before_widget'];
     if (!empty($title)) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     dokan_get_template_part('widgets/widget-content-product', '', array('r' => $r, 'show_rating' => $show_rating));
     echo $args['after_widget'];
     wp_reset_postdata();
 }
 /**
  * Front-end display of widget.
  *
  * @see WP_Widget::widget()
  *
  * @param array $args     Widget arguments.
  * @param array $instance Saved values from database.
  */
 public function widget($args, $instance)
 {
     $title = apply_filters('widget_title', $instance['title']);
     extract($instance);
     $r = dokan_get_top_rated_products($no_of_product);
     echo $args['before_widget'];
     if (!empty($title)) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     if ($r->have_posts()) {
         echo '<ul class="dokan-bestselling-product-widget product_list_widget">';
         while ($r->have_posts()) {
             $r->the_post();
             wc_get_template('content-widget-product.php', array('show_rating' => $show_rating));
         }
         echo '</ul>';
     } else {
         echo "<p>No products found</p>";
     }
     echo $args['after_widget'];
     wp_reset_postdata();
 }
Beispiel #3
0
}
?>

        <?php 
if (dokan_get_option('show_top_rated', 'dokan_home', 'on') == 'on') {
    ?>
            <div class="slider-container woocommerce">
                <h2 class="slider-heading"><?php 
    _e('Top Rated Products', 'dokan');
    ?>
</h2>

                <div class="product-sliders">
                    <ul class="slides">
                        <?php 
    $top_rated_query = dokan_get_top_rated_products();
    ?>
                        <?php 
    while ($top_rated_query->have_posts()) {
        $top_rated_query->the_post();
        ?>

                            <?php 
        wc_get_template_part('content', 'product');
        ?>

                        <?php 
    }
    ?>
                    </ul>
                </div>
    /**
     * Render top rated products via shortcode
     *
     * @param  array  $atts
     *
     * @return string
     */
    function top_rated_product_shortcode($atts)
    {
        /**
         * Filter return the number of top rated product per page.
         *
         * @since 2.2
         *
         * @param array
         */
        $per_page = shortcode_atts(apply_filters('dokan_top_rated_product_per_page', array('no_of_product' => 8), $atts));
        ob_start();
        ?>
        <ul>
            <?php 
        $best_selling_query = dokan_get_top_rated_products();
        ?>
            <?php 
        while ($best_selling_query->have_posts()) {
            $best_selling_query->the_post();
            ?>

                <?php 
            wc_get_template_part('content', 'product');
            ?>

            <?php 
        }
        ?>
        </ul>
        <?php 
        return ob_get_clean();
    }
    /**
     * Render top rated products via shortcode
     *
     * @param  array  $atts
     *
     * @return string
     */
    function top_rated_product_shortcode($atts)
    {
        $per_page = shortcode_atts(array('no_of_product' => 8), $atts);
        ob_start();
        ?>
        <ul>
            <?php 
        $best_selling_query = dokan_get_top_rated_products();
        ?>
            <?php 
        while ($best_selling_query->have_posts()) {
            $best_selling_query->the_post();
            ?>

                <?php 
            wc_get_template_part('content', 'product');
            ?>

            <?php 
        }
        ?>
        </ul>
        <?php 
        return ob_get_clean();
    }