WPBeginner

Beginner's Guide for WordPress

  • Blog
    • Beginners Guide
    • News
    • Opinion
    • Showcase
    • Themes
    • Tutorials
    • WordPress Plugins
  • Start Here
    • How to Start a Blog
    • Create a Website
    • Start an Online Store
    • Best Website Builder
    • Email Marketing
    • WordPress Hosting
    • Business Name Ideas
  • Deals
    • Bluehost Coupon
    • SiteGround Coupon
    • WP Engine Coupon
    • HostGator Coupon
    • Domain.com Coupon
    • Constant Contact
    • View All Deals »
  • Glossary
  • Videos
  • Products
X
☰
Beginner's Guide for WordPress / Start your WordPress Blog in minutes
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

WPBeginner» Blog» Plugins» Adding a Post Rating System in WordPress with WP-PostRatings

Adding a Post Rating System in WordPress with WP-PostRatings

Last updated on April 27th, 2015 by Editorial Staff
40 Shares
Share
Tweet
Share
Pin
Free WordPress Video Tutorials on YouTube by WPBeginner
Adding a Post Rating System in WordPress with WP-PostRatings

We were recently looking to incorporate a simple post rating system in our project and had to deal with numerous plugins. After going through several, we found the one that works best for adding a post rating system in WordPress was “WP-PostRatings” by Lester ‘GaMerZ’ Chan. In this article, we will walk you through setting up an AJAX rating system for your WordPress blog posts and pages.

Video Tutorial

Subscribe to WPBeginner

If you don’t like the video or need more instructions, then continue reading.

First you need to download and activate the WP-PostRatings Plugin (For beginners: Step by Step Guide to Installing a WordPress Plugin)

Upon activation, the plugin will add a new menu item in your WordPress admin bar labeled ‘Ratings’.

We will skip the “Managed Ratings” option, and start out with the second link in the tab called “Rating Options”.

WP Post Ratings settings page

On the plugin’s settings page, first you need to select which rating image you want to use for your posts. The plugin comes with a number of options like bars, heart, numbers, plus-minus, the classic stars, thumbs up/down, up-down arrows, etc.

Once you have picked the rating system that you like, you can select the “Max Ratings”. The plugin will pick an appropriate value for you, but when using bars image, you may want to specify your own value of rating. For stars and numbers it seems pointless to go over 5 because there are only 5 stars.

Remember, if you do adjust the Max Ratings, you will need to adjust the Individual Rating Text/Value. If you do not change the Max Rating value from default, then leave the Individual ratings to be default as well.

Then you will see the option for Ajax Style, Rating Permission, and Logging Method.

Ratings Ajax Style and logging method

You can follow the styling in the image above for best results. However if you want to customize, you may need to change these.

We are done with this page, save the changes. Let’s move onto the “Ratings Templates” page. On this page, you will see different rating templates and how you want to organize them. We left them with the default value, but you are more than welcome to utilize the Template Variables on top of the screen to modify them. This is basically to show how your ratings will be displayed. Once you are done with the “Ratings Templates” page, you are ready to add this in your theme.

Depending on how your theme is setup, you will need to add the following codes within the LOOP in the following files (archives.php, page.php, index.php, single.php, loop.php etc) – You may not have all of these files in your theme depending on the structure.

<?php if(function_exists('the_ratings')) { the_ratings(); } ?>

Note, this will add the post rating to all posts. If you just want to use it on selective posts, you can utilize the shortcode [ratings id=”1″ results=”true”] to display the ratings on just that post or page.

Now that you have ratings added, your users will be voting on your posts. You can view those ratings from the “Manage Ratings” option that we skipped initially. This allows you to see a log of ratings on each post, and you can delete them as well if you feel that there is something wrong going on.

The best part about this plugin is that it has an ability to show the Highest Rated Posts (option for time range and category), Most Rated Posts (option for time range and category), Lowest Rating and Highest rating with the same option of time range and category. Most of the times, these type of stats are added in the sidebar, so this plugin allows you to utilize the Widgets to display these (only if your theme support widgets – Most DO!). Simply go to Appearence » Widgets and find the Ratings widget. Drag it in the appropriate location and set the settings you want.

Ratings widget options

Now if you notice in the above screenshot, there are bunch of options. First is to select the title of your widget. It is best to select like “Most Rated Posts This Week” or something. Depending on how you do rest of your settings. Statistic Type field has tons of options which allow you to show Highest Rated, Most Rated, Lowest Rating, and Highest Rating. You also have the option to pick these stats by category or by time. The next option asks whether you want to include both your posts and pages. This is entirely a personal choice. So pick as you like. The widget shows 10 most popular entires by default, but it can be changed by editing the No. of Records to Show. We strongly recommend that you don’t make it more than 10 because it just looks bizarre with most designs. You can also set the number of minimum votes a post needs to have before it can make it into this list. Depending on your site design, you may or may not want to adjust the Maximum Post Title length. If your theme location is wide enough, we recommend that you set the value to 0 to disable it. If you are using the Category or Time specific statistic type, then you would need to modify the last two fields. Click and save and you are done.

Now we know that some of you are code junkies and do not want to use the widget settings. Lester has compiled a very detailed Usage Tab on his site which explains how to add the most rated, highest rated etc. directly into your WordPress Themes. Refer to WP-PostRatings Usage Guide.

We hope this article helped you add a post rating system on your WordPress site. You may also want to take a look at our guide on how to engage readers with post reactions in WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

40 Shares
Share
Tweet
Share
Pin
Popular on WPBeginner Right Now!
  • Checklist

    Checklist: 15 Things You MUST DO Before Changing WordPress Themes

  • How to Fix the Error Establishing a Database Connection in WordPress

    How to Fix the Error Establishing a Database Connection in WordPress

  • Revealed: Why Building an Email List is so Important Today (6 Reasons)

    Revealed: Why Building an Email List is so Important Today (6 Reasons)

  • Google Analytics in WordPress

    How to Install Google Analytics in WordPress for Beginners

About the Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Trusted by over 1.3 million readers worldwide.

The Ultimate WordPress Toolkit

52 Comments

Leave a Reply
  1. Kyle says:
    Sep 29, 2020 at 1:24 pm

    Hi I am very new to WP and can’t seem to figure out how to add the code to the LOOP in archives.php, page.php, index.php, single.php, loop.php etc. Can you please provide a little guidance?
    Thank you

    Reply
    • WPBeginner Support says:
      Sep 30, 2020 at 10:08 am

      If you reach out to your specific theme’s support they should be able to assist with locating the loop in your theme.

      Reply
  2. Ivan says:
    Apr 15, 2020 at 5:19 am

    Hi, is there a option to rate with a ‘half star’ ?, i saw there is a picture showing ‘half star’ , thanks

    Reply
    • WPBeginner Support says:
      Apr 15, 2020 at 9:13 am

      You can create custom icons if you want but the half stars are normally for the average for the rating

      Reply
  3. Rohit jha says:
    Mar 4, 2020 at 5:30 am

    Awesome! Your Every blog are very Very useful for us…

    Reply
    • WPBeginner Support says:
      Mar 4, 2020 at 8:34 am

      Glad you found our guide useful :)

      Reply
  4. Shoaib Saleem says:
    Jun 11, 2019 at 2:40 am

    Hi,
    How to get top rated posts in WordPress? I am using custom code to rate post with comments. The rating value is storing in comment meta table.I need help to get 5 top rated posts.
    Thanks

    Reply
    • WPBeginner Support says:
      Jun 11, 2019 at 10:32 am

      You would want to take a look at the plugin’s FAQ for the answer to this question :)

      Reply
  5. Radu Giurgiu says:
    Feb 14, 2019 at 2:28 pm

    Hello!

    It is a good general information about this rating plugin, with is good.
    But… what happen if the user what to re-star (rating) the post?
    Seems the plugin not allowing tho let the user change his opinion about a specific post. Wich is very important.

    There is a solution for that?

    Reply
    • WPBeginner Support says:
      Feb 15, 2019 at 9:56 am

      For that, you would want to reach out to the plugin’s support to see if that could be a feature to add

      Reply
      • Radu Giurgiu says:
        Feb 15, 2019 at 10:09 am

        Yes of course.

        Ok. Thanks!

        Reply
  6. Riyaz Shaikh says:
    Dec 24, 2018 at 1:41 pm

    Thank you for sharing this article. Was of great help, I was struglling with this since months, but and today could install Rating plug in on webpage.

    Thanks to you

    Reply
    • WPBeginner Support says:
      Dec 24, 2018 at 5:06 pm

      Hi Riyaz,

      Glad you found it helpful.

      Reply
  7. Faruk says:
    Apr 15, 2018 at 2:38 pm

    I cant change the visuality, i mean stars

    Reply
  8. Umang says:
    Apr 1, 2018 at 1:25 pm

    We have recently implemented the rating plugin on our company’s blog posts and it is work like a charm.

    Google Rich Snippets setting is also a great option but I think it should be enabled by default.

    Thanks for sharing such a useful plugin.

    Reply
  9. Carlos says:
    Sep 4, 2017 at 4:50 am

    How can I make the stars show up in the SERPS?

    Reply
  10. Dmitry says:
    Aug 26, 2017 at 4:24 am

    what is PHP function or shortcode to show ratings of a post ID?

    Reply
  11. Gobind Singh says:
    Nov 12, 2016 at 9:45 am

    I’m trying to run that plugin in local server. The stars have shown up in my post but I’m not able to do rating. How can I solve this problem? Please help me..

    Reply
  12. Gail Palubiak says:
    Apr 6, 2016 at 11:57 am

    It sounds interesting but I found your explanation inadequate.

    “Depending on how your theme is setup, you will need to add the following codes within the LOOP in the following files (archives.php, page.php, index.php, single.php, loop.php etc) – You may not have all of these files in your theme depending on the structure.”

    Most information please.

    Reply
  13. surya JD says:
    Jan 29, 2016 at 2:30 am

    hey thanks but as I know this plugin won’t work with any cache plugin.
    But on your blog you are using this plugin with w3 total cache . right ?
    what tricks you used to work this plugin with cache plugins…

    Reply
  14. vinod says:
    Sep 14, 2015 at 8:19 am

    it is a great wordpress plugin

    Reply
  15. Boby Kurniawan says:
    Feb 1, 2014 at 3:58 am

    The stars is show up, but the stars cannot be clicked . Sorry for bad english

    Reply
    • surya JD says:
      Jan 29, 2016 at 2:31 am

      May be you are using any cache plugin on your site. this plugin won’t work with cache plugin.

      Reply
  16. Mathias says:
    Sep 17, 2013 at 6:02 pm

    Could you guys please help me??? I don’t get that plugin to sort posts by rating on my homepage… I’m a total beginner in coding… where exactly do I have to put which lines of code to sort my posts by rating??? Please help me!

    Reply
    • WPBeginner Support says:
      Sep 18, 2013 at 11:38 pm

      You need to add the code in your theme’s template files inside the WordPress Loop.

      Reply
      • GTMan says:
        Jul 9, 2015 at 6:49 pm

        Actually which code do we need to add in loop?

        Reply
  17. tdu says:
    Aug 7, 2013 at 9:23 pm

    is it possible to have multiple ratings in a single post for different categories?
    something like this?

    http://cl.ly/image/0Y1o1c0x0W1P

    Reply
    • Editorial Staff says:
      Aug 11, 2013 at 12:25 pm

      Try GD Star Rating – http://wordpress.org/plugins/gd-star-rating/

      Reply
      • Doro says:
        Dec 10, 2015 at 9:05 am

        No longer available. Any alternative? :-)

        Reply
    • Valter Cardoso says:
      Jul 1, 2015 at 3:07 am

      I was wondering the same thing. I am trying to make a voting system that the most posted categories will be arranged on top of the post. Can someone help me how to do this, please? Here’s the site I am building with this concept

      Reply
  18. Anwar says:
    Mar 16, 2013 at 12:57 pm

    I don’t see it on your site anymore

    Reply
    • Editorial Staff says:
      Mar 17, 2013 at 11:46 pm

      We are using a variation of this plugin to allow author rating (but no more user ratings).

      Reply
  19. Mike Antkowiak says:
    Feb 6, 2013 at 10:24 pm

    Hey there great tutorial. I am using this plugin and I want to apply it to custom post types. Is there a way to add custom post types to the widget display?
    Thanks for you time.

    Reply
    • surya JD says:
      Jan 29, 2016 at 2:37 am

      yes If you created post template for custom post type aka CPT you can add
      in post loop.
      if you already don’t have custom template for CPT you can create in your theme folder or in child theme of main theme.

      Reply
  20. salem says:
    Jan 27, 2013 at 3:07 pm

    Hi
    Is their way to make plug-in files load from the theme
    I the my Site using Firebug Ysalow and find the loading.gif take long time to loading .

    Reply
    • Editorial Staff says:
      Jan 28, 2013 at 8:00 am

      You should be able to turn off the CSS file that is being loaded from this plugin and merge that in your theme’s CSS file. For more instructions read here:

      https://www.wpbeginner.com/wp-tutorials/how-wordpress-plugins-affect-your-sites-load-time/

      Reply
      • salem says:
        Jan 28, 2013 at 7:02 pm

        Thanks a lot it’s really help

        Reply
  21. R Thorp says:
    Dec 13, 2012 at 7:36 am

    Thankyou! Solid advice, easy to folow guidance! However it would have been better if you included a little bit about adding the codes into the loop files, as i had to refer to other websites to find this.
    Cheers

    Reply
  22. blue says:
    Sep 24, 2012 at 5:11 am

    my jquery wont work because of this plugin.. :(

    Reply
    • Editorial Staff says:
      Sep 24, 2012 at 9:16 am

      Quite the opposite of a problem to have. jQuery doesn’t rely on this plugin. This plugin relies on jQuery.

      Reply
  23. Shady M Rasmy says:
    Jul 30, 2012 at 7:33 am

    i know its on old post and i don’t think i will get a reply on it
    but i will ask any way :D
    is there a way to collect the costume filed data for each user to show it in a page
    for logged in user
    example what i mean
    if i voted this post up
    and other posts
    can i show those posts later from page my likes for example ?
    sorry bad English :)

    Reply
    • Editorial Staff says:
      Jul 30, 2012 at 9:40 am

      Don’t think that it’s possible with this particular plugin.

      Reply
  24. محمد جبران says:
    Jul 16, 2012 at 12:03 am

    Thanks for the great instruction. Though the latter link gives 404

    Reply
    • Editorial Staff says:
      Jul 17, 2012 at 10:17 am

      Fixed it :)

      Reply
  25. wpbeginner says:
    May 30, 2011 at 1:01 am

    There must be some issue with how the plugin is entering the code. You can always disable the normal integration, and paste the code directly in your template.

    Reply
  26. Anna747 says:
    May 27, 2011 at 10:27 pm

    I added the codes to the files listed but the ratings were showing up at the bottom of my page below the footer instead of below the post? I only want them below the post, not on my pages/homepage…and right below the post.

    Reply
    • arbitrarylifestyle says:
      Nov 4, 2011 at 2:01 am

      You’d want to find out the specific place you want the ratings to show up. For example, mine show up just beside the title so I put my code next to the title as so:

      Yeah!!!

      Reply
  27. Shad says:
    Feb 3, 2011 at 11:13 am

    Awhile back I was conceptualizing a site for short-story authors. The member would submit a story(post) and the other members would critique the story (as comments).

    What I was looking for then, and what is similar to this post, is a way for the original author to select comments as helpful (as in an thumbs up with note that said “Author found this comment helpful”). Has anyone seen anything such as that? Where the actual comments are rated?

    Reply
    • Auz says:
      Apr 4, 2011 at 12:53 pm

      I am currently using GD Star Rating for our rating system. It has been very flexible, but probably a little more advanced than wp-postratings. It does have the ability to allow comment ratings. For an example check out our site (www.bendbeerblog.com)

      I eventually want to connect the ratings with the untappd.com API. I am hoping I can hook into the system, but if not I may have to write a custom solution.

      Reply
  28. Keith Davis says:
    Jan 28, 2011 at 1:19 pm

    Plugin looks great but I’m trying to cut down the number of plugins that I use.

    It’s all too easy to just keep adding plugins.

    Thanks for another great tut.

    Reply
  29. Connor Crosby says:
    Jan 26, 2011 at 4:28 pm

    Awesome! I wonder if they use this or something similar for the tuts+ network.

    Reply
    • Editorial Staff says:
      Jan 26, 2011 at 4:55 pm

      They are using something similar. WordPress.org showcase is using this plugin :)

      Reply

Leave a Reply Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Over 1,320,000+ Readers

Get fresh content from WPBeginner

Featured WordPress Plugin
All in One SEO logo
All in One SEO
Improve website SEO rankings with AIOSEO plugin. Learn More »
How to Start a Blog How to Start a Blog
I need help with ...
Starting a
Blog
WordPress
Performance
WordPress
Security
WordPress
SEO
WordPress
Errors
Building an
Online Store
Useful WordPress Guides
    • 7 Best WordPress Backup Plugins Compared (Pros and Cons)
    • How to Fix the Error Establishing a Database Connection in WordPress
    • Why You Need a CDN for your WordPress Blog? [Infographic]
    • 30 Legit Ways to Make Money Online Blogging with WordPress
    • Self Hosted WordPress.org vs. Free WordPress.com [Infograph]
    • Free Recording: WordPress Workshop for Beginners
    • 24 Must Have WordPress Plugins for Business Websites
    • How to Properly Move Your Blog from WordPress.com to WordPress.org
    • 5 Best Contact Form Plugins for WordPress Compared
    • Which is the Best WordPress Popup Plugin? (Comparison)
    • Best WooCommerce Hosting in 2020 (Comparison)
    • How to Fix the Internal Server Error in WordPress
    • How to Install WordPress - Complete WordPress Installation Tutorial
    • Why You Should Start Building an Email List Right Away
    • How to Properly Move WordPress to a New Domain Without Losing SEO
    • How to Choose the Best WordPress Hosting for Your Website
    • How to Choose the Best Blogging Platform (Comparison)
    • WordPress Tutorials - 200+ Step by Step WordPress Tutorials
    • 5 Best WordPress Ecommerce Plugins Compared
    • 5 Best WordPress Membership Plugins (Compared)
    • 7 Best Email Marketing Services for Small Business (2020)
    • How to Choose the Best Domain Registrar (Compared)
    • The Truth About Shared WordPress Web Hosting
    • When Do You Really Need Managed WordPress Hosting?
    • 5 Best Drag and Drop WordPress Page Builders Compared
    • How to Switch from Blogger to WordPress without Losing Google Rankings
    • How to Properly Switch From Wix to WordPress (Step by Step)
    • How to Properly Move from Weebly to WordPress (Step by Step)
    • Do You Really Need a VPS? Best WordPress VPS Hosting Compared
    • How to Properly Move from Squarespace to WordPress
    • How to Register a Domain Name (+ tip to get it for FREE)
    • HostGator Review - An Honest Look at Speed & Uptime (2020)
    • SiteGround Reviews from 4196 Users & Our Experts (2020)
    • Bluehost Review from Real Users + Performance Stats (2020)
    • How Much Does It Really Cost to Build a WordPress Website?
    • How to Create an Email Newsletter the RIGHT WAY (Step by Step)
    • Free Business Name Generator (A.I Powered)
    • How to Create a Free Business Email Address in 5 Minutes (Step by Step)
    • How to Install Google Analytics in WordPress for Beginners
    • How to Move WordPress to a New Host or Server With No Downtime
    • Why is WordPress Free? What are the Costs? What is the Catch?
    • How to Make a Website in 2020 – Step by Step Guide
Deals & Coupons (view all)
Smash Balloon Coupon
Smash Balloon Coupon
Get 50% off Smash Balloon's powerful social media feed plugins.
MemberPress
MemberPress Coupon
Get up to 50% OFF on MemberPress WordPress premium membership plugin.
Featured In
About WPBeginner®

WPBeginner is a free WordPress resource site for Beginners. WPBeginner was founded in July 2009 by Syed Balkhi. The main goal of this site is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress beginners to improve their site(s).
Join our team: We are Hiring!

Site Links
  • About Us
  • Contact Us
  • FTC Disclosure
  • Privacy Policy
  • Terms of Service
  • Free Blog Setup
  • Free Business Tools
Our Sites
  • OptinMonster
  • MonsterInsights
  • WPForms
  • SeedProd
  • Nameboy
  • RafflePress
  • Smash Balloon

Copyright © 2009 - 2021 WPBeginner LLC. All Rights Reserved. WPBeginner® is a registered trademark.

Managed by Awesome Motive | WordPress hosting by SiteGround | WordPress CDN by MaxCDN | WordPress Security by Sucuri.