There are plenty of plugins available which allow site visitors to rate posts, but I didn’t find any that gave the post author that functionality, so I wrote this plugin. Author Post Ratings adds a meta box to the post edit screen, allowing you to chose a 1-5 star rating for the post, or to leave it unrated. The plugin will automatically add the post rating (using stars, and an optional label) to the top or bottom of the post. If you wish, you can disable that functionality altogether and use a shortcode to insert the post rating anywhere in the post you choose. The plugin supports ratings for posts, pages, and custom post types, all of which can be individually enabled or disabled in the plugin settings. It is also fully internationalized, with Spanish language translation files included.
Download
You can download the plugin from its page in the WordPress plugin directory.
Screenshots
- The post rating meta box which can be enabled for posts, pages, or custom post types
- A post with an author post rating displayed in the Twenty-Eleven theme
Installation
Author Post Ratings is installed just like any other WordPress plugin. No configuration is required, but if you wish, you may change the plugin settings at Settings > Author Post Ratings.
If you’re not familiar with installing WordPress plugins, follow these steps to install the plugin:
Automatic Installation
- Login to your WordPress dashboard, and go to Plugins > Add New.
- In the Search box, type in ‘Author Post Ratings’, and click ‘Search Plugins’.
- Author Post Ratings should be the first item in the list. Click on ‘Install Now’.
- WordPress will download and install the plugin. Click on the ‘Activate Plugin’ link, and you’re in business!
Manual Installation Via FTP
- Download the plugin to your computer, and unzip it.
- Using an FTP program, upload the ‘author-post-ratings’ folder to your `/wp-content/plugins/` directory.
- Activate the plugin through the ‘Plugins’ menu in WordPress.
Manual Installation Via WordPress Upload
- Download the plugin ZIP file to your computer.
- In your WordPress dashboard, go to Plugins > Add New.
- Click on the ‘Upload’ link at the top.
- In the file selection box, select the plugin ZIP file on your computer, and click on ‘Install Now’.
- WordPress will upload and install the plugin. Click on the ‘Activate Plugin’ link, and you’re in business!
FAQ
How do I customize the CSS of the post rating output?
You can edit author-post-ratings.css
in the plugin folder.
I don’t like the star graphics that come with the plugin, or I want to use a different color. Can I change them?
Sure, just replace the two images in the author-post-ratings/images/
directory with your own star images. You can also download the Photoshop source files for the supplied star images here: author-post-ratings-photoshop-files.zip.
Where do I get support for this plugin?
Please use the plugin’s support forum on WordPress extend.
Are there any functions I can use in my template files?
Yes. You can use get_author_post_rating( $post_id )
and the_author_post_rating( $post_id )
in your templates. Passing the post ID is optional, if you don’t include it the plugin will use get_the_ID()
to try and figure it out for itself. You can pass the current post ID, or the ID of another post if you wish.
get_author_post_rating()
will return the numeric post rating, if the post has one. This value does not include the HTML markup or star images which would surround the post rating on a normal post, it just returns the rating value itself.
the_author_post_rating()
will echo the post rating along with the label and star images. Optionally, you can set the second parameter to true to return the markup instead of echoing it, like this:
$rating_markup = the_author_post_rating( $post_ID, true );
This plugin is useful and I want to donate to the author.
Thank you! Please head on over to my donate page. Any donation, no matter how large or small, is greatly appreciated!
Translating the Plugin
The post rating label text can be changed in the plugin settings, so no translation is required for the frontend (public side) of the site. However, if you wish to translate the backend settings interface, the plugin is fully internationalized and ready for translation. There is a .po and a .mo file included in the plugin’s ‘languages’ directory for your convenience.
The plugin includes the following translations:
- Spanish courtesy of WebHostingHub.
Changelog
- 1.1.1 (2013-11-30)
- Added Spanish language translation files, courtesy of WebHostingHub. No changes to main plugin code.
- 1.1 (2012-09-03)
- Added option to only show the rating in singular views, to hide the post rating on archive pages when the `<!–more–>` quicktag is used in place of true excerpts
- Updated readme.txt: clarified installation instructions, added documentation for new plugin setting, added translating section
- Updated screenshot of plugin settings page to show new settings field
- Changed the way the plugin handles its saved settings internally
- Updated language files
- 1.0 (2012-08-14)
- Initial release
Help
If you need help, please do not comment on this page asking for help. Instead, open a new thread on the plugin’s support forum on WordPress extend. That way others will be more likely to see your thread and benefit from the solution, or possibly even help you themselves.
Pingback: Author Post Ratings 1.0 Released | Philip Newcomer
I love the idea, but I’m not finding a place to edit the settings. Also, I would love to have 1/2 star settings too.
Hi Joe,
After the plugin is activated, the settings page is in Settings->Author Post Ratings. In the post editor, if the Post Rating meta box isn’t displayed, you may need to go up to Screen Options at the top right and turn it on.
As for 1/2 stars, I’ll keep that in mind for a future release.
I love this plugin too. Does what I want. But I realy need 1/2 star ratings.
Please, work on a 1/2 star. I really loved your plugin for my music website. So simple but I would like to give half stars to records…
Got it. Thank you.
Pingback: Author Post Ratings 1.1 Update - Philip Newcomer
how do you choose where to place the ratings. It just comes up on the top of my posts.
JJ, the settings page is in Settings->Author Post Ratings. You can choose to display the rating at the top of the post, the bottom of the post, or only by shortcode.
thanks
First of all, thank you. It took me three weeks to finally stumble across this plugin. It is almost exactly what I need. Needless to say, I’ll be donating as soon as my wife gives me my discretionary fund allowance for October 😀
I have a few questions and which may suggest some new features for upcoming releases. I would like to have more than one rating per review. I’m not a programmer, but I am taking a look at the code now to see if I can do this myself. I review anime on my blog and it would be nice to be able to review various aspects of the medium. Take a look at this review to see how it looks now:
http://tylerregas.com/anime-reviews/linebarrels-of-iron-updated/
I’m looking at four entries that would look like this:
Animation: ***** | Story: ***** | Originality: ***** | Character Design: *****
I would place this in a simple DIV that would span the line across the top of the review and have a different background color. Optimally, I would prefer to have a box that the text would wrap around and would be aligned left at the top of the review, like so:
_______________________
| |
| Thumbnail |
| |
|______________________|
| Animation: ***** |
| Story: ***** |
| Originality: ***** |
| Character Design: ***** |
————————————
I would not use anything but the most clean and clear CSS, as in no rounded corners or weird fonts, for the layout. Now, I always add a featured image to my reviews, but I would assume that code would check to see if any image is attached to the post and, if not, simply insert the ratings block.
Now, at some point I’m sure you’re asking yourself if I’m getting to the questions. I am 🙂 First one, I see the add_settings_field that is called label_text. Is it possible to repeat that N times to create additional fields? Something like this:
add_settings_field( ‘label_text_1’, __(‘Label text 1’, ‘author-post-ratings’), ‘pn_apr_settings_field_label_text’, ‘pn_apr_settings’, ‘appearance’ );
add_settings_field( ‘label_text_2’, __(‘Label text 2’, ‘author-post-ratings’), ‘pn_apr_settings_field_label_text’, ‘pn_apr_settings’, ‘appearance’ );
add_settings_field( ‘label_text_3’, __(‘Label text 3’, ‘author-post-ratings’), ‘pn_apr_settings_field_label_text’, ‘pn_apr_settings’, ‘appearance’ );
add_settings_field( ‘label_text_4’, __(‘Label text 4’, ‘author-post-ratings’), ‘pn_apr_settings_field_label_text’, ‘pn_apr_settings’, ‘appearance’ );
Now, I can’t code PHP to save my life, but it looks like I would have to update this code as well:
$validated[‘label_text_1’] = wp_kses_post( (string) $input[‘label_text_1’] );
$validated[‘label_text_2’] = wp_kses_post( (string) $input[‘label_text_2’] );
$validated[‘label_text_3’] = wp_kses_post( (string) $input[‘label_text_3’] );
$validated[‘label_text_4’] = wp_kses_post( (string) $input[‘label_text_4’] );
This is where I lose the thread, but it looks like this code outputs to the loop:
$output .= ” . esc_attr( $pn_apr_settings[‘label_text’] ) . ‘ ‘;
I’m not sure how to update this, though it may look like this:
$output .= ” . esc_attr( $pn_apr_settings[‘label_text_1’], $pn_apr_settings[‘label_text_2’], $pn_apr_settings[‘label_text_3’], $pn_apr_settings[‘label_text_4’] ) . ‘ ‘;
It’s now that I realize that I would also need to create additional ratings, and that’s where I’m completely lost 😛 There would need to be more ratings objects, just like the label objects, but I don’t understand that code 🙂 I get the feeling that were I to add the label code, that they would appear in the post widget, but would not be able to output any data and end up breaking the theme.
Here are some more questions 🙂
Q: Can I make the ratings 10 stars instead of 5?
Q: If I am able to add additional ratings, how would they output using your current code? Would they just be inline?
Q: Can I update the output code to show the post title like so, adding the pipe for visual separation?
$output .= ” | . esc_attr( $pn_apr_settings[‘label_text’] ) . ‘ ‘;
Sorry for the long bit that. I don’t intend to make more work for you, but if you have a few free minutes to look this over that would be awesome. I can also tell you that there are a lot of people out there who are looking for a tool that does just this.
Thank you.
Tyler
Hey, this is pretty neat!..I need these features too
Hello i want to add rating in other page manually using code i tried adding this in php file
Rating: ID,’get_author_post_rating’,true);?>
But didn’t worked please help me out.
The plugin provides the get_author_post_rating() and the_author_post_rating() functions for that very purpose. However, if you want to pull the post rating directly from the custom field, you can use this format:
Hello,
Like Tyler Regas ” It took me three weeks to finally stumble across this plugin. It is almost exactly what I need.”
Thanks a lot.
My question : What may I do to be able to put 0 star? not unrated but 0 star?
Thanks.
That’s not currently a feature of the plugin; you’d need to hard-code that functionality in. However, if enough people request that feature, I would add it. I’m just not going to add bloat to the plugin by adding features that few people would use.
Hello, I want to add the code manually but I can not, try with this code
“?php get_author_post_rating(); ?”
but it simply does not appear. Greetings.
The
get_author_post_rating()
function will return the rating for further processing with PHP. Usethe_author_post_rating()
if you want to output it directly.Hi!
I really like this plugin. Simple and slick. But does it support Google Rich Snippets?
Hi Jonas,
Not at this time. However, that looks like it might be a useful feature, so I’ll put it on the list for the next update.
This is a great plugin. It would be even better IMHO if one could set the label text on a per post basis to override the default in Settings.
Would be great if you could add google rich snippets.
It’ rally a helpfull thing and i love to use it in my site. But what i really would need is the opportunity to give half stars.
thx Gregor
also the function with 0 stars would be good and also the google thing
🙂
Thanks for the feedback, everyone! I’ll be releasing an update to the plugin as soon as I have some free time, and I’ll include the most-requested features in it.
hi philip, exactly the plug in that i search for. but how can i change the label text “Rating:” in Unterhaltungs-/Kreativitätsfaktor?
i ve done it so:
function pn_apr_get_defaults()
{
$defaults = array(
‘label_text’ => __( ‘Unterhaltungs-/Kreativitätsfaktor:’, ‘author-post-ratings’ ),
‘position_on_post’ => ‘top’, // Options: top, bottom, or shortcode
‘post_types_enabled’ => array( ‘post’ ),
‘show_only_on_singular’ => false
but it doesnt show my fav text, can you help? thx
sorry, i`ve found how it works
Hi, please forgive my ignorance.
What function do I use to set the rating ? and what file would I put that function in.
I am using a template and have been trying to get this working for hours.
Hi, I’m not sure I understand what you are asking. Are you asking how to add a rating to a post, or something else? There is a meta box on the post edit screen where you set the rating for that post.
I love this plugin. I need some help.
It’s possible Best rating – Top 10 posts. I mean
Post1 – 5Star
Post4 – 5Star
Post2 – 4Star
Post5 – 4Star
Post3 – 3Star
Pingback: WordPress plugins etc. | HydraGear
Hi,
just wanted to share some ideas in case you find them useful. In my blog (where I use this plugin of your, which I thank you for), I needed two additions:
– display a list of posts that received specific rating (to see what’s best, mostly)
– order posts in categories by rating, so the newest of the best would always be first to see
The latter is not for everyone, so I also added a flag on the settings page to trigger this. In case you’re interested, code is shared on BitBucket: https://bitbucket.org/hydralien/author-post-ratings/src – or you can just check out teh diff, for that matter: https://bitbucket.org/hydralien/author-post-ratings/commits/1d287685776ae879f6b521a5232b57d00d7278bb
Cheers,
Boris Turchik
Boris, Thanks for giving your work back to the community. I had a look at your code, and it looks good except you need to prefix the new functions you have added as described here: http://codex.wordpress.org/Writing_a_Plugin#Plugin_Development_Suggestions
Philip,
thanks for the tip, that’s helpful (and I adjusted my code) – sorry, that was my first approach on WP plugins, missed some guidelines.
Cheers,
Boris Turchik
Hello Boris,
I’m very interested in how you created the list of posts with the specific rating. I got your code from BitBucket but I don’t see where you can display this. Any help is really appreciated.
Thanks,
Bonnie
Great plugin. Works like a charm.
Please, half stars! 🙂
Thanks alot for this plugin i have an issue though i cant seem to find the widget page i have looked in screen options and cannot see it what am i doing wrong?
There is no widget in this plugin, that’s why you can’t find it. 🙂
Hi thank you for this great plugin, exactly what I was looking for. One small issue, when I post, the stars come first then it says our rating at the end. I have been to the settings and they all seem fine, so not sure why it is coming back to front eg. ***** Our rating: . Your help would be much appreciated.
Best wishes
It sounds like your theme’s styles may be interfering with the display of the stars. Check to see what styles may be inherited from your theme.
10 stars and 1/2 ratings would be great.
When is the next update going to be released?
Will the star rating show up on search results?
Can this be used for wordpress.com?
Emie, unfortunately no, this plugin can only be installed on self-hosted WordPress installs.