????? (15 reviews)
-
Awesome plugin! Thank you!
May you please provide any code to display reviews quantity on a product archive page just near the stars rating:
To look like that? ????? (15 reviews)
Because currently only star rating are visible and I would like it to show the reviews count as well near the stars.
Appreciate if you can share any code with me to be able to customize that,
I’ve found the following php code which work, but not sure will it fit and where to past it to work correctly:
<div class=”product-ratings”> <?php if ( get_option( ‘woocommerce_enable_review_rating’ ) === ‘no’ ) { return; } $rating_count = $product->get_rating_count(); $review_count = $product->get_review_count(); $average = $product->get_average_rating(); if ( $rating_count > 0 ) : ?> <div class=”woocommerce-product-rating” itemprop=”aggregateRating” itemscope itemtype=”https://schema.org/AggregateRating”> <div class=”star-rating” title=”<?php printf( __( ‘Rated %s out of 5’, ‘woocommerce’ ), $average ); ?>”> <span style=”width:<?php echo ( ( $average / 5 ) * 100 ); ?>%”> <strong itemprop=”ratingValue” class=”rating”><?php echo esc_html( $average ); ?> <?php printf( __( ‘out of %s5%s’, ‘woocommerce’ ), ‘<span itemprop=”bestRating”>’, ‘</span>’ ); ?> <?php printf( _n( ‘based on %s customer rating’, ‘based on %s customer ratings’, $rating_count, ‘woocommerce’ ), ‘<span itemprop=”ratingCount” class=”rating”>’ . $rating_count . ‘</span>’ ); ?> </span> </div> <?php if ( comments_open() ) : ?>(<?php printf( _n( ‘%s customer review’, ‘%s customer reviews’, $review_count, ‘woocommerce’ ), ‘<span itemprop=”reviewCount” class=”count”>’ . $review_count . ‘</span>’ ); ?>)<?php endif ?> </div> <?php endif; ?> </div><!– .product-ratings –>
Thank you in advance!
Kind regards
- The topic ‘????? (15 reviews)’ is closed to new replies.