Rating count beside star rating
-
I used the below code in rating.php file as instructed to show the rating count beside the star rating on the shop page:
if ( ! defined( ‘ABSPATH’ ) ) {
exit;
}global $product;
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 ) : ?>
<?php echo wc_get_rating_html($average, $rating_count); ?>
<?php if ( comments_open() ): ?>#reviews” class=”woocommerce-review-link” rel=”nofollow”>(<?php printf( _n( ‘%s’,$review_count,’woocommerce’ ), ‘<span class=”count”>’ . esc_html( $review_count ) . ‘</span>’ ); ?>)<?php endif ?>
<?php endif; ?>However, the issue is that the rating count is on a 2nd line instead of showing beside the rating itself. How can I display the rating count beside the star rating?
The page I need help with: [log in to see the link]
- The topic ‘Rating count beside star rating’ is closed to new replies.