How to display Empty Stars when 0 reviews
-
Hi there!
Great plugin you’ve made! Thank you for it!
Please may you tell how to make visible Empty Starts on a Single Product and Product Category pages ?
I’ve found this code and it works when editing 1473 line of your plugin code (file: class.yith-woocommerce-advanced-reviews.php ):
public function get_product_rating_html ( $rating_html, $rating ) { global $product; $rating_html = ''; $rating = $this->get_average_rating ( $product->id ); $noreview = ''; if ( ICL_LANGUAGE_CODE=='en' ){ $noreview = "No reviews yet";} else { $noreview = '<div class="star-rating" title="' . sprintf ( __ ( 'Rated %s out of 5', 'yith-woocommerce-advanced-reviews' ), $rating ) . '">';} if ( $rating > 0 ) { $rating_html = '<div class="star-rating" title="' . sprintf ( __ ( 'Rated %s out of 5', 'yith-woocommerce-advanced-reviews' ), $rating ) . '">'; $rating_html .= '<span style="width:' . ( ( $rating / 5 ) * 100 ) . '%"><strong class="rating">' . $rating . '</strong> ' . __ ( 'out of 5', 'yith-woocommerce-advanced-reviews' ) . '</span>'; $rating_html .= '</div>'; }else{ $rating_html = '<div>'.$noreview.'</div>'; } return $rating_html; }
But it disappear on every update of your plugin and it also not making visible empty stars on a Single product page – only on a Product Category pages.
May you please share any correct code which I can insert in my theme functions.php to maintain the visibility of empty stars on a Single Product Page and Product Category Page ?
Greatly Appreciate you help!
With Regards!
- The topic ‘How to display Empty Stars when 0 reviews’ is closed to new replies.