Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wc_get_star_rating_html( $rating, $count = 0 ) {
- $html = '<span style="width:' . ( ( $rating / 5 ) * 100 ) . '%">';
- if ( 0 < $count ) {
- /* translators: 1: rating 2: rating count */
- $html .= sprintf( _n( 'Rated %1$s out of 5 based on %2$s customer rating', 'Rated %1$s out of 5 based on %2$s customer ratings', $count, 'woocommerce' ), '<strong class="rating">' . esc_html( $rating ). '</strong>', '<span class="rating">' . esc_html( $count ) . '</span>' );
- } else {
- /* translators: %s: rating */
- $html .= sprintf( esc_html__( 'Rated %s out of 5', 'woocommerce' ), '<strong class="rating">' . esc_html( $rating ) . '</strong>' );
- }
- $html .= '</span>';
- return apply_filters( 'woocommerce_get_star_rating_html', $html, $rating, $count );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement