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.

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”.

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.

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.

1
<?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.

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.

1
<?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.

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!

Pin It on Pinterest

Add address