Woocommerce 3.0.0 Support

This commit is contained in:
Jason King 2017-04-14 20:24:55 +09:30 committed by GitHub
parent 282489a2f0
commit 27fd9d67f9
1 changed files with 7 additions and 4 deletions

View File

@ -1,7 +1,7 @@
<?php
/**
* The template to display the reviewers star rating in reviews
*
* Updated for Understrap to maintain Woocommerce 3.0.3 compatability.
* This template can be overridden by copying it to yourtheme/woocommerce/content-product.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
@ -13,7 +13,7 @@
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.6.0
* @version 3.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
@ -25,8 +25,11 @@ $rating = intval( get_comment_meta( $comment->comment_ID, 'rating', true ) );
if ( $rating && get_option( 'woocommerce_enable_review_rating' ) === 'yes' ) { ?>
<div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating" class="star-rating text-primary" title="<?php echo sprintf( esc_attr__( 'Rated %d out of 5', 'understrap' ), esc_attr( $rating ) ) ?>">
<span style="width:<?php echo ( esc_attr( $rating ) / 5 ) * 100; ?>%"><strong itemprop="ratingValue"><?php echo esc_attr( $rating ); ?></strong> <?php esc_attr_e( 'out of 5', 'understrap' ); ?></span>
<div class="star-rating">
<span style="width:<?php echo ( esc_attr( $rating ) / 5 ) * 100; ?>%"><?php
/* translators: %s: rating */
printf( esc_html__( '%s out of 5', 'understrap' ), '<strong>' . $rating . '</strong>' );
?></span>
</div>
<?php }