add-to-cart
9 years ago
tabs
9 years ago
meta.php
9 years ago
photoswipe.php
9 years ago
price.php
9 years ago
product-attributes.php
9 years ago
product-image.php
9 years ago
product-thumbnails.php
9 years ago
rating.php
9 years ago
related.php
9 years ago
review-meta.php
9 years ago
review-rating.php
9 years ago
review.php
9 years ago
sale-flash.php
9 years ago
share.php
9 years ago
short-description.php
9 years ago
stock.php
9 years ago
title.php
9 years ago
up-sells.php
9 years ago
review-rating.php
36 lines
| 1 | <?php |
| 2 | /** |
| 3 | * The template to display the reviewers star rating in reviews |
| 4 | * |
| 5 | * This template can be overridden by copying it to yourtheme/woocommerce/content-product.php. |
| 6 | * |
| 7 | * HOWEVER, on occasion WooCommerce will need to update template files and you |
| 8 | * (the theme developer) will need to copy the new files to your theme to |
| 9 | * maintain compatibility. We try to do this as little as possible, but it does |
| 10 | * happen. When this occurs the version of the template file will be bumped and |
| 11 | * the readme will list any important changes. |
| 12 | * |
| 13 | * @see https://docs.woocommerce.com/document/template-structure/ |
| 14 | * @author WooThemes |
| 15 | * @package WooCommerce/Templates |
| 16 | * @version 3.0.0 |
| 17 | */ |
| 18 | |
| 19 | if ( ! defined( 'ABSPATH' ) ) { |
| 20 | exit; // Exit if accessed directly |
| 21 | } |
| 22 | |
| 23 | global $comment; |
| 24 | $rating = intval( get_comment_meta( $comment->comment_ID, 'rating', true ) ); |
| 25 | |
| 26 | if ( $rating && get_option( 'woocommerce_enable_review_rating' ) === 'yes' ) { ?> |
| 27 | |
| 28 | <div class="star-rating"> |
| 29 | <span style="width:<?php echo ( esc_attr( $rating ) / 5 ) * 100; ?>%"><?php |
| 30 | /* translators: %s: rating */ |
| 31 | printf( esc_html__( '%s out of 5', 'woocommerce' ), '<strong>' . $rating . '</strong>' ); |
| 32 | ?></span> |
| 33 | </div> |
| 34 | |
| 35 | <?php } |
| 36 |