Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter WPDragon

    (@wpdragon)

    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

    (@mythemeshop)

    Hi,
    Unfortunately this is not available in current version, maybe we will add this function in our upcoming updates.
    thanks.

    Thread Starter WPDragon

    (@wpdragon)

    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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘User Rating code’ is closed to new replies.