Hi @mariansu,
There is a way but I can’t guarantee that it’ll work on every theme and with every version of the WP-PostRatings plugin, hence the reason why the plugin only lists the current rating.
If you’re willing to give it a try, here’s what you need to do:
- Assuming you’re using the widget, go to Appearance > Widgets.
- Click on the WordPress Popular Posts widget on your sidebar to expand it and access its options.
- Find and untick the “Display Post Rating” option as we won’t be using that, then click on Save to apply changes.
- Add the following code snippet to your site (here’s how):
/**
* Parses custom content tags in WordPress Popular Posts.
*
* @param string $html The HTML markup from the plugin.
* @param integer $post_id The post/page ID.
* @return string
*/
function wpp_parse_tags_in_popular_posts($html, $post_id){
// Replace custom content tag {rate_post} with
// the actual rating component
if (
false !== strpos($html, '{rate_post}')
&& function_exists('the_ratings')
) {
// Get rating component
$rating = the_ratings('span', $post_id, false);
// Replace {rate_post} with the rating component
$html = str_replace('{rate_post}', $tag_links, $html);
}
return $html;
}
add_filter( "wpp_parse_custom_content_tags", "wpp_parse_tags_in_popular_posts", 10, 2 );
- Go back to Appearance > Widgets > WordPress Popular Posts.
- Under HTML Markup settings, tick the option “Use custom HTML Markup”, then click on Save to apply changes.
- Set Post HTML Markup something like:
<li>
{thumb} {title} <span class="wpp-meta post-stats">{stats}</span>
<div class="wpp-rating">
{rate_post}
</div>
</li>
- Finally, click on Save to apply changes.
If everything went well, you should be able to rate your popular posts directly from the popular post list.
Marking as resolved due to inactivity.