How To: Add post ratings to your WordPress blog

Published on May 16th, 2011

Last Updated on November 14th, 2018

Share This Article

Post ratings are a great way to get feedback from your readers about your posts, you can see which ones are popular and tailor your content to include more of these types. Post ratings are also used for other purposes such as image galleries powered by WordPress, review blogs etc.  One of the best (and free!) plugins for this purpose is WP Post Ratings, in this post I will show you how to install and setup this plugin.

Install The Plugin

Download the WP Post Ratings, then upload it to your wp-content/plugins folder via ftp. You can download a free ftp client called Filezilla for this purpose.

You can also upload the plugin directly, via your wordpress admin panel by clicking Plugins > Add New > Upload > Install Now.

You will also need to enter your ftp settings there as well, your webhost will have provided these when you signed up.

Once the plugin is uploaded, visit your plugins page and click “activate” next to both of the plugins. You will now see a new menu item called “Ratings”.

Add the Ratings code to your theme

Now you have activated the plugin, you need to place a small piece of code into your theme which tells the plugin where to show the ratings widget. For the purpose of this demo I will be using the default TwentyTen theme and placing the code on the single blog post page.

Go to “Appearance” > “Editor” and select “Loop-Single” from the right hand list of templates. In the code, look for :

[sourcecode language=”php”]
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

Directly underneath that, add this code :

Article Continues Below

[sourcecode language=”php”]
<?php if(function_exists(‘the_ratings’)) { the_ratings(); } ?>

That will display the rating widget at the top of the post, before the title.

You can play about with the positioning of the widget by moving it around in the single-loop template, for instance if you wanted it to appear at the end of the post. Click “Update File” to save the code and then visit a single post and you should see the widget now appears :

Configuring the plugin

If you click the menu item “Ratings Options” you will see the settings you can use to customise the rating widget for your site. At the top are a number of graphics you can choose instead of the default star images :

After you have chosen your required images, you can choose whether to show text with them, fading options and who is allowed to vote: whether you want guests to vote or only registered members etc.

The next menu item is “Manage Ratings” – in this option you can see all the ratings you have received, which post they were on, the users IP address and time of vote. This is helpfull to prevent fraudulent voting.

Article Continues Below

The next menu item is “Ratings Templates” you dont need to touch this unless you want to do some advanced customisation of the ratings widget – here you can change the text that is displayed, where the images are displayed etc by the use of tags :

The final option is “Uninstall WP Post Ratings”, this just gives you the option to remove all traces of the plugin from your site.

Oliver Dale is the founder of Kooc Media, An Internet Company based in Manchester, UK. I founded WPLift in 2010.