User Rating code
-
Hi…is there a way to display the average user rating, similar to this:
<?php if (function_exists('wp_review_show_total')) wp_review_show_total(); ?>
Thanks
-
Any help or advice would be greatly appreciated…Im trying to find out if the Avg. USER Rating, can be displayed similar to the function below:
<?php if (function_exists(‘wp_review_show_total’)) wp_review_show_total(); ?>
Thank you.
Hi,
Unfortunately this is not available in current version, maybe we will add this function in our upcoming updates.
thanks.Thanks for the reply…If this can be added into an upcoming update it would definitely be useful!
Thanks again.
I wanted this feature too…you can accomplish it with this workaround I came up with:
1. Add this code where you want the reviews/stars to show:
<?php $post_id = $post->ID; $postReviews = mts_get_post_reviews( $post_id ); $total = $postReviews[0]->reviewsNum; $user_average = $postReviews[0]->reviewsAvg; //echo $user_average; $percent = round((float)$user_average * 100 / 5 ) . '%'; //echo $percent; ?> <div class="review-total-star-comments"> <div class="review-result-wrapper"> <i class="mts-icon-star icon-star"></i> <i class="mts-icon-star icon-star"></i> <i class="mts-icon-star icon-star"></i> <i class="mts-icon-star icon-star"></i> <i class="mts-icon-star icon-star"></i> <div class="review-result" style="width: <?php echo $percent; ?>;"> <i class="mts-icon-star icon-star"></i> <i class="mts-icon-star icon-star"></i> <i class="mts-icon-star icon-star"></i> <i class="mts-icon-star icon-star"></i> <i class="mts-icon-star icon-star"></i> </div><!-- .review-result --> </div><!-- .review-result-wrapper --> </div>
2. Add the CSS for the .review-total-star-comments div and everything nested in it directly to your theme. You can find this with Chrome developer tools etc.
- The topic ‘User Rating code’ is closed to new replies.