Overall ratings in new version. When?
Overall ratings is a much needed feature that has been asked many times but there is no clear answers so far. It really should be included in this plugin.
Are the developpers interested in adding this feature at all?
In the meantime is there an easy way for non coder to get the overall ratings stars to be shown on same page and/or on a different page using a shortcode that could be then inserted anywhere on a post?
Does someone know how to do it?
well, I think it’s a good question to ask for overall-ratings. Sadly, the link doesn’t work anymore.
Can anybody help me?
Hope this helps then … it appears to look like this.
global $wpdb; $pId = $post->ID; //if using in another page, use the ID of the post/page you want to show ratings for. $row = $wpdb->get_results("SELECT COUNT(*) AS <code>total</code>,AVG(review_rating) AS <code>aggregate_rating</code>,MAX(review_rating) AS <code>max_rating</code> FROM wp_2_wpcreviews WHERE <code>page_id</code>= $pId AND <code>status</code>=1"); $max_rating = $row->max_rating; $aggregate_rating = $row->aggregate_rating; $total_reviews = $row->total; $totl = $aggregate_rating * 20; $wpdb->flush();
For a visual display
<div class="sp_rating" id="wpcr_respond_1"><div class="base"> <div style="width: <?php echo $totl;?>%" class="average"></div></div><?php echo ' ' ?><br/> <?php echo "Rating: <strong>" . (round ($aggregate_rating,1)) . "</strong>/5 (" . $total_reviews . " votes cast)";?></span></p>
In text form
Average score of <?php echo (round ($aggregate_rating,1)) . " for " . $total_reviews . " reviews.";?>
& for my multi-site install I had to rename the database to “wp_2_wpcreviews” where 2 is the site #
I think that was it. I have it running on the homepage & on the single page too. Works a treat
- The topic ‘Overall ratings in new version. When?’ is closed to new replies.