/
var
/
www
/
barefootlaw.org
/
wp-content
/
themes
/
barefoot
/
inc
/
woocommerce
/
Upload File
HOME
<?php if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Recent Reviews Widget. * * @author WooThemes * @category Widgets * @package WooCommerce/Widgets * @version 2.3.0 * @extends WC_Widget */ if ( ! class_exists( 'Covercase_WC_Widget_Recent_Reviews' ) ) { class Covercase_WC_Widget_Recent_Reviews extends WC_Widget_Recent_Reviews { /** * Constructor. */ public function __construct() { $this->widget_cssclass = 'woocommerce widget_recent_reviews'; $this->widget_description = __( 'Display a list of recent reviews from your store.', 'covercase' ); $this->widget_id = 'woocommerce_recent_reviews'; $this->widget_name = __( 'Recent Product Reviews', 'covercase' ); $this->settings = array( 'title' => array( 'type' => 'text', 'std' => __( 'Recent reviews', 'covercase' ), 'label' => __( 'Title', 'covercase' ), ), 'number' => array( 'type' => 'number', 'step' => 1, 'min' => 1, 'max' => '', 'std' => 10, 'label' => __( 'Number of reviews to show', 'covercase' ), ), ); parent::__construct(); } /** * Output widget. * * @see WP_Widget * * @param array $args * @param array $instance */ public function widget( $args, $instance ) { global $comments, $comment; if ( $this->get_cached_widget( $args ) ) { return; } ob_start(); $number = ! empty( $instance['number'] ) ? absint( $instance['number'] ) : $this->settings['number']['std']; $comments = get_comments( array( 'number' => $number, 'status' => 'approve', 'post_status' => 'publish', 'post_type' => 'product', 'parent' => 0 ) ); if ( $comments ) { $this->widget_start( $args, $instance ); echo '<ul class="product_list_widget">'; foreach ( (array) $comments as $comment ) { $_product = wc_get_product( $comment->comment_post_ID ); $rating = intval( get_comment_meta( $comment->comment_ID, 'rating', true ) ); $rating_html = wc_get_rating_html( $rating ); echo '<li><div class="clearfix"><div class="widget_shopping_cart_thumb"><a href="' . esc_url( get_comment_link( $comment->comment_ID ) ) . '">'; printf('%s', $_product->get_image() . '</a></div><div class="widget_shopping_cart_desc">' ); echo '<a href="' . esc_url( get_comment_link( $comment->comment_ID ) ) . '">' . wp_kses_post( $_product->get_name() ) . '</a>'; printf('%s', $rating_html); /* translators: %s: review author */ echo '<span class="reviewer">' . sprintf( esc_html__( 'by %s', 'covercase' ), get_comment_author() ) . '</span>'; echo '</div></li>'; } echo '</ul>'; $this->widget_end( $args ); } $content = ob_get_clean(); printf('%s', $content ); $this->cache_widget( $args, $content ); } } }