Title: User Rating code
Last modified: August 22, 2016

---

# User Rating code

 *  Resolved [WPDragon](https://wordpress.org/support/users/wpdragon/)
 * (@wpdragon)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/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
 * [https://wordpress.org/plugins/wp-review/](https://wordpress.org/plugins/wp-review/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [WPDragon](https://wordpress.org/support/users/wpdragon/)
 * (@wpdragon)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/user-rating-code/#post-5400256)
 * 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.
 *  Plugin Author [MyThemeShop](https://wordpress.org/support/users/mythemeshop/)
 * (@mythemeshop)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/user-rating-code/#post-5400275)
 * Hi,
    Unfortunately this is not available in current version, maybe we will add
   this function in our upcoming updates. thanks.
 *  Thread Starter [WPDragon](https://wordpress.org/support/users/wpdragon/)
 * (@wpdragon)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/user-rating-code/#post-5400309)
 * Thanks for the reply…If this can be added into an upcoming update it would definitely
   be useful!
 * Thanks again.
 *  [Chris Perryman](https://wordpress.org/support/users/revconcept/)
 * (@revconcept)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/user-rating-code/#post-5400373)
 * 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.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘User Rating code’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-review_e57c82.svg)
 * [WordPress Review Plugin: The Ultimate Solution for Building a Review Website](https://wordpress.org/plugins/wp-review/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-review/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-review/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-review/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-review/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-review/reviews/)

## Tags

 * [user rating](https://wordpress.org/support/topic-tag/user-rating/)

 * 4 replies
 * 3 participants
 * Last reply from: [Chris Perryman](https://wordpress.org/support/users/revconcept/)
 * Last activity: [11 years, 4 months ago](https://wordpress.org/support/topic/user-rating-code/#post-5400373)
 * Status: resolved