Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. function wc_get_star_rating_html( $rating, $count = 0 ) {
  2.     $html = '<span style="width:' . ( ( $rating / 5 ) * 100 ) . '%">';
  3.  
  4.     if ( 0 < $count ) {
  5.         /* translators: 1: rating 2: rating count */
  6.         $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>' );
  7.     } else {
  8.         /* translators: %s: rating */
  9.         $html .= sprintf( esc_html__( 'Rated %s out of 5', 'woocommerce' ), '<strong class="rating">' . esc_html( $rating ) . '</strong>' );
  10.     }
  11.  
  12.     $html .= '</span>';
  13.  
  14.     return apply_filters( 'woocommerce_get_star_rating_html', $html, $rating, $count );
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement