Rate My Stuff: A Plugin for WordPress
Rate My Stuff allows you to create attractive, customizable, star-based rating images on your site like this:





The above image was created with the following syntax: [rate 4]
Why?
Because I’ve started to review some of the books I read and some of the movies that Reneé and I watch, I wanted to have a graphical rating system, and I didn’t want to manually insert all the images every time. Basically, I’m lazy. ![]()
I had written a private plugin to do this that required the PHP Exec plugin; it just made a function available for me to call it from the post. But I’d been wanting to play with WordPress’ “real” plugin capabilities for a bit to flex my tiny PHP muscles, and this seemed like a good first shot.
Besides, I didn’t see any plugins like this advertised, so I figured I may as well throw my hat in the ring. Maybe someone else will find a good use for it. I guess it’s a small way of giving back to the people I’ve gotten so much from over the years.
Installation
Installing is ridiculously easy:
- Download the ZIP file and dump the contents into your plugins folder. A subfolder will be created to hold the stock rating icons that come with the plugin.
- Activate the appropriate plugin in your Plugin Management screen.
- Use the appropriate rating method depending on your chosen plugin, detailed below.
Which Plugin Do I Use?
As you can see in the code, there are actually two separate plugin files in your plugins folder: rate-my-stuff.php and rate-my-stuff-custom-field.php. The first file is the “classic” version that was released as version 1.0, and the second is the new super-cool version I put together for Chris to accomodate his needs. This means you now can create ratings in two different ways:
- Using the tag syntax (described below) in the body of your actual post.
- Using a custom field when you create the post in WordPress.
So the choice of plugin depends on how you want to handle ratings. Using the custom field has the bonus that the data is stored as metadata in the database, and you can query on it as an attribute of the post rather than having to parse the actual post content, but you also have to modify all template files where you want the rating to appear to use the new template tag. Using the tag syntax in the post, while not being properly geeky, is sufficiently simple that you can slap the rating anywhere you like and it will just work. I use the tag syntax on this site, but that’s only because I’m not 100% sure how I’ll handle reviews in the future, and once that shakes out I’ll probably migrate to using the custom field.
And for those who truly can’t make a decision, yes, you can use both plugins simultaneously.
Using the Custom Field
Activate the plugin file Rate My Stuff - Custom Field Variant in your Plugin Management screen. The plugin comes pre-configured to use a custom field called rating (not sure if this is case-sensitive or not) that will take any value, but I highly recommend you stick to a number from 1 to 5. ![]()
Also, in order to actually display the rating, you will need to modify every template file where you want the rating to be shown. Add the following code to display the rating:
<?php show_post_rating($post->ID); ?>
By default the plugin will output the rating wrapped in a div with a class of rating, ready for your mad CSS skillz.
Using the Tag Syntax
Activate the plugin file Rate My Stuff in your Plugin Management screen. You can now use the sugary-sweet tag syntax in your post/page content as many times as you see fit.
The tag syntax is brain-dead simple:
- an opening square bracket
- the word “rate”
- a space
- a number from 1-5
- optionally, a decimal followed by the number 5 to denote a half-rating
- a closing square bracket
Here are the tags you can use “out of the box”:
| [rate 0] | ![]() ![]() ![]() ![]() ![]() |
|---|---|
| [rate 0.5] | ![]() ![]() ![]() ![]() ![]() |
| [rate 1] | ![]() ![]() ![]() ![]() ![]() |
| [rate 1.5] | ![]() ![]() ![]() ![]() ![]() |
| [rate 2] | ![]() ![]() ![]() ![]() ![]() |
| [rate 2.5] | ![]() ![]() ![]() ![]() ![]() |
| [rate 3] | ![]() ![]() ![]() ![]() ![]() |
| [rate 3.5] | ![]() ![]() ![]() ![]() ![]() |
| [rate 4] | ![]() ![]() ![]() ![]() ![]() |
| [rate 4.5] | ![]() ![]() ![]() ![]() ![]() |
| [rate 5] | ![]() ![]() ![]() ![]() ![]() |
Like I said, brain-dead simple. You can see a few examples of it in use on this site.
Gotchas
Just one. If you rate something has having only 0.5 stars, you must write it as 0.5 and not as .5. This is because of how the code is written, and because I’m lazy. And oh yeah, I prefer being explicit. But if you just have to have it, write up an alternative and I might implement it.
Oh, and don’t forget to modify your template files if you are using the Custom Field Variant.
Customizing
There are two main ways to customize the script as it comes “out of the box” so to speak: changing the images used, and changing the maximum number of icons displayed. You would do the latter if you wanted to use a 10-star scale rather than just five, for instance.
Changing the images is, again, brain-dead simple. Just change the three deceptively named images in the rate-my-stuff folder. These images should be named rating_star.solid.gif, rating_star.half.gif, and rating_star.empty.gif. Completely defying years of web design commandments, the script does not output image height and width in any way, so you can make them as large or small as you like without having to change the script at all. However, it now outputs appropriate alt attributes for each image.
If you want to change the maximum number of images used in the rating, or change the alt text for the images (because you’re anal that way) then you want to work in the core.php file located in the rate-my-stuff folder. You’ll see the variables inside the config block, and it should all be self-explanatory. Just change them to whatever you like.
The code itself has some ugly warts to it, but hey, it Works For Me™!
Questions? Suggestions?
Please direct all feedback to this post.
Change Log
- 1.1 - Split into “classic” and “custom field variant” plugins
- 1.0 - Initial release

I just love your plugin and I’ve just installed it at my blog. Thanks a lot for it! Anyway, I have a suggestion: since a lot of people have different paths to wordpress core files and the blog itself, you should change (inside core.php) the get_bloginfo(’url’) to get_bloginfo(’wpurl’) and it’d work for everyone
Thanks!
Nina