Sorry that is not possible currently as there is no RATINGS IMAGE template variable for it.
Thanks for the quick reply. Maybe consider that as a feature to add in a later update?
Option for a thumbnail image, size settings, title, excerpt with some basic css styling would be AWESOME! It would take your module to a whole new level for reporting the lists.
Thank you again for the quick support! A+
Definitely! When I have the time to do it =)
You can join wp_ratings table with wp_posts and then loop th posts. This is the code I use (I just copied it from my script). Put in your themes function.php. Then you can use the shortcode [wpb_most_rated] to display Most rated with images. Note that it may or not may work in your particular situation. Hope that helps.
///***** Most Rated articles *****/
function wpb_most_rated_posts() {
// start output buffering
ob_start();
?>
<div class="most-commented">
<?php
// Run WP_Query
global $wpdb;
$query = '
SELECT a.ID, a.post_title, a.guid, b.rating_id, b.rating_postid, b.rating_rating, sum(b.rating_rating)
FROM
'. $wpdb->posts .' a INNER JOIN '. $wpdb->ratings .' b ON a.ID = b.rating_postid
group by
a.ID
';
$results = $wpdb->get_results( $query, OBJECT );
if ($results):
global $post;
foreach ($results as $post):
setup_postdata($post);
//begin loop
?>
<article class="cp-wrap cp-small clearfix">
<div class="cp-thumb-small">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php if (has_post_thumbnail()) { the_post_thumbnail('cp-thumb-small'); } else { echo '<img src="' . get_template_directory_uri() . '/images/placeholder-thumb-small.jpg' . '" alt="No Picture" />'; } ?></a>
</div>
<p class="entry-meta"><span class="updated"><?php echo get_the_date(); ?></span></p>
<h3 class="cp-title-small"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"><?php the_title(); ?></a></h3>
<?php echo do_shortcode( '[ratings results="true"]' ); ?>
<span class="entry-meta-lower"><?php echo $comments; ?></span>
</article>
<hr class="mh-separator">
<?php endforeach; ?>
<?php endif;
// end loop
?>
</div>
<?php
// Turn off output buffering
$output = ob_get_clean();
//Return output
return $output;
}
// Create shortcode
add_shortcode('wpb_most_rated', 'wpb_most_rated_posts');
//Enable shortcode execution in text widgets
add_filter('widget_text', 'do_shortcode');
EDIT: Of course you need to use your theme’s html.
Sorry – this needs a fix (I’m still testing it). After:
group by
a.ID
add:
order by avg(b.rating_rating) desc
I also noticed that my permalinka are not working (points to website root instead of posts).