Support » Plugin: WordPress Popular Posts » Rating for the posts

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Héctor Cabrera


    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:

    1. Assuming you’re using the widget, go to Appearance > Widgets.
    2. Click on the WordPress Popular Posts widget on your sidebar to expand it and access its options.
    3. Find and untick the “Display Post Rating” option as we won’t be using that, then click on Save to apply changes.
    4. 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 );
    5. Go back to Appearance > Widgets > WordPress Popular Posts.
    6. Under HTML Markup settings, tick the option “Use custom HTML Markup”, then click on Save to apply changes.
    7. Set Post HTML Markup something like:
          {thumb} {title} <span class="wpp-meta post-stats">{stats}</span>
          <div class="wpp-rating">
    8. 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.

    Plugin Author Héctor Cabrera


    Marking as resolved due to inactivity.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.