wc_get_rating_html()
Get HTML for ratings.
Hooks from the function
Returns
String.
Usage
wc_get_rating_html( $rating, $count );
- $rating(float) (required)
- Rating being shown.
- $count(int)
- Total number of ratings.
Changelog
| Since 3.0.0 | Introduced. |
wc_get_rating_html() wc get rating html code WC 10.6.2
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 );
}