A Post/Page/Custom Post Type’s rating is the average of all comment ratings. A user can leave a rating when commenting, and change that rating inline after leaving a comment (if logged-in or Cookie’d).
Don’t be afraid to play around and extend the code: drop a
rate.css file in your theme directory and mine won’t even load (by default, Rate stars are transparent with a white border, so you can use
background-color to set your stars’ colors)!
<?php // in this version, you need to insert these functions into your theme for ratings to appear // you don't have to use the_rating(), the comment_rating() will work by itself, but the_rating() will not // for a Post, Page, or Custom Post Type (average of all comment ratings) the_rating(); // for a comment the_comment_rating(); ?>
Read More: http://scottctaylor.wordpress.com/2010/11/30/new-plugin-rate/
Contributors & Developers
“Rate” is open source software. The following people have contributed to this plugin.Мүчөлөрү
- Added jQuery as a required script – Whoops!
- Whoops, adds second argument to
rate_calculate($id = 0, $is_comment = false)for internal purposes
the_rating()now excludes ratings from comments that are awaiting moderation.
the_rating($id = 0)will not take an argument of ID. Use it to show a rating anywhere.
- User can leave a rating while commenting now, can still edit rating inline after comment is posted
- I broke the rate.css path, oops!
- Got rid of Divide by Zero warning that PHP was throwing
- Does not count ratings of Zero or non-ratings in the Average Rating displayed by the_rating()
- Added screenshots to the Plugin page at WordPress.org
- Initial release