[Plugin: kk Star Ratings] Ordering posts with same rating average
-
The plugin doesn’t seem to promote posts with more perfect votes over those with fewer, but the same average star-rating. Could that be implemented or considered a feature request? It seems that when listing the top rated posts, those with the same average are listed chronologically by post date and ascending, so that an old post with a perfect rating that doesnt get any lower ratings will continue to be the top rated post forever. Am I incorrect?
I am using the following function to show top-rated posts in a widget and the client complained that the same older post has been top-rated for several months. There are a few 100%-rated posts. If I could promote those with more perfect ratings over those with fewer, then order those posts with the same number of perfect ratings by post date or ID (“DESC”), that would be great.
<?php if(function_exists('kk_star_ratings_get')) : $top_rated_posts = kk_star_ratings_get(3); endif; foreach($top_rated_posts as $post) { $post_id = $post->ID; $queried_post = get_post($post_id); echo "<li id='rated-post-id-" . $post_id . "'>"; echo "<a href='".get_permalink($post_id)."'>"; echo get_the_post_thumbnail($post_id, 'top-rated'); echo "</a><a href='".get_permalink($post_id)."'>".$queried_post->post_title."</a>"; echo " <span style='font-size:10px;'>(".$post->ratings."/5)</span>"; echo "<p class='excerpt'>"; echo substr($queried_post->post_content, 0, 120); echo "…</p>"; echo "<br></li>"; }?>
Thanks!
- The topic ‘[Plugin: kk Star Ratings] Ordering posts with same rating average’ is closed to new replies.