wc_get_rating_html( float $rating, int $count )
Get HTML for ratings.
Description Description
Parameters Parameters
- $rating
-
(Required) Rating being shown.
- $count
-
(Required) Total number of ratings.
Return Return
(string)
Source Source
File: includes/wc-template-functions.php
function wc_get_rating_html( $rating, $count = 0 ) {
$html = '';
if ( 0 < $rating ) {
/* translators: %s: rating */
$label = sprintf( __( 'Rated %s out of 5', 'woocommerce' ), $rating );
$html = '<div class="star-rating" role="img" aria-label="' . esc_attr( $label ) . '">' . wc_get_star_rating_html( $rating, $count ) . '</div>';
}
return apply_filters( 'woocommerce_product_get_rating_html', $html, $rating, $count );
}
Changelog Changelog
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |