How to add a rating system to WordPress post

Whether in product review or a article post, rating system has been a very good way of showing the usability and trustworthiness of a product , also it shows the pros and cons so that customer can understand the real truth.

In WordPress, you can easily add a rating system where you can judge popularity of your article or a WooCommerce product.

So, lets move forward, we need to install a plugin to achieve it very easily and we can show the reviews on any page we want. We will use WP Post Ratings plugin. You can download it from WordPress.org .

Download and install the plugin, if you do not know how to install a WordPress plugin, then you can learn it from here.

After installing you will get the WP Ratings dashboard in the WordPress admin panel. You can play with different rating options by going Ratings at your admin panel (Look at the bottom).

 

Ratings Settings
Ratings Settings

 

You can select the rating design from this settings page, also you can select the number of maximum ratings. Enable Google Rich Snippet so that the post along with ratings will be fetch when someone searches your site.

You can now place the following function into any place like single.php, archive.php, page.php .

 

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

 

Keep in kind that you need to place it inside the loop.

You can also get the most rated post or most rated post from a specific category. Below is the code for most rated posts

 

<?php if (function_exists('get_most_rated')): ?>
<ul>
<?php get_most_rated(); ?>
</ul> 
<?php endif; ?> 

 

The above code will fetch both the pages and post. If you just want to show posts then you need replace the following line

 

<?php get_most_rated(post,0,10); ?>

 

If you want to show only the pages, then you need have this line:

 

<?php get_most_rated(page,0,10); ?>

 

There are many possibilities of showing rating with posts and pages. This ratings plugin is a gem. You can have nice design with theme too.

 

Leave a Comment

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

Scroll to Top