Contributors: GamerZ
Donate link: http://lesterchan.net/site/donation/
Tags: ratings, rating, postratings, postrating, vote, digg, ajax, post
Requires at least: 2.8
Tested up to: 4.2
Stable tag: 1.81
Adds an AJAX rating system for your WordPress blog's post/page.
https://github.com/lesterchan/wp-postratings
http://dev.wp-plugins.org/browser/wp-postratings/i18n/
I spent most of my free time creating, updating, maintaining and supporting these plugins, if you really love my plugins and could spare me a couple of bucks, I will really appreciate it. If not feel free to use it without any obligations.
- NEW: Added worstRating of 1. Props @rafaellop
- NEW: Checked for defined() for RATINGS_IMG_EXT to allow overwrite
- FIXED: Integration with WP-Stats
- NEW: Suppor Custom Post Types in Widgets
- NEW: Added 'wp_postratings_process_ratings_user', 'wp_postratings_process_ratings_userid' & 'wp_postratings_check_rated' filters
- NEW: Supports WordPress Multisite Network Activate
- NEW: Uses WordPress native uninstall.php
- NEW: Use POST for ratings instead
- NEW: Add 'wp_postratings_schema_itemtype' filter so that you can change the Schema Type. See the FAQ for sample.
- FIXED: Use 'is_rtl()' instead of $text_direction
- NEW: Uses Dash Icons
- NEW: Option to turn off Google Rich Snippets
- FIXED: Use SITECOOKIEPATH instead of COOKIEPATH. Props jbrule.
- FIXED: If global $id is 0, use get_the_ID(). Props instruite.
- FIXED: use esc_attr() and esc_js() to escape characters
- NEW: Add in %POST_ID% template variables
- FIXED: Ensure Google Rich Snippet only displays in main loop and not in the widget
- FIXED: Removed reviewCount from Google Rich Snippet
- FIXED: Make the ratings widget more optimized
- FIXED: Some widget templates are using postratings_template_mostrated instead of postratings_template_highestrated
- FIXED: No longer needing add_post_meta() if update_post_meta() fails
- FIXED: Update 'Individual Rating Text/Value' Display no working due to missing nonce
- FIXED: Added stripslashes() to remove slashes in the templates
- FIXED: Check whether it is an array to prevent array_key_exists() from throwing a warning.
- Change htmlspecialchars to esc_attr(). Props Ryan Satterfield.
- Change esc_attr() to wp_kses() For itemprop. Props oneTarek.
- check_rated_username() should be using $user_ID. Props Artem Gordinsky.
- Add Stars Flat (PNG) Icons. Props hebaf.
- Change Schema From http://schema.org/Product To http://schema.org/Article
- Fixed not logging ratings
- Fixed sorting of ratings logs
- Fixed "unable to delete logs/data"
- Add rate_post action for other plugins to use. Props paulgibbs.
- Prevent direct access to PHP files to avoid PHP errors. Props paulgibbs.
- Fixes for PHP Notices. Props paulgibbs.
- Improvements. Props paulgibbs.
- Better and safer handling of input variables
- Removed some manual SQL in favour of WP's API.
- Audited the rest of the SQL to make sure it was safe.
- Removed unneeded switch() block, and decreased the line indentation for better readability :)
- Use $wpdb->prepare() for SQL statements in wp-postratings.php
- esc_attr(). Props felipedjinn.
- Fixed "Creating default object from empty value"
- Added Text Domain To Plugin
- Added Tested To 3.5
- Add "Ratings" Column To Manage Pages In WP-Admin
- Add Sortable "Ratings" Column To Manage Posts/Pages In WP-Admin
- NEW: Move AJAX Request to wp-admin/admin-ajax.php
- NEW: Added nonce To AJAX Calls And Admin Pages
- NEW: Added Support For Google Rich Snippet
- FIXED: Escaped Hostname
- FIXED: Ensure Ratings Post ID In Shortcode Is An Integer
- FIXED: XSS Vulnerability. Thanks Dion Hulse aka dd32
- FIXED: Removed Global $post
- NEW: Works For WordPress 2.8 Only
- NEW: Javascript Now Placed At The Footer
- NEW: Uses jQuery Instead Of tw-sack
- NEW: Minified Javascript Instead Of Packed Javascript
- NEW: Renamed postratings-admin-js-packed.js To postratings-admin-js.js
- NEW: Renamed postratings-admin-js.js To postratings-admin-js.dev.js
- NEW: Renamed postratings-js-packed.js To postratings-js.js
- NEW: Renamed postratings-js.js To postratings-js.dev.js
- NEW: Translate Javascript Variables Using wp_localize_script()
- NEW: Added In Most Rated & Highest Rated Pages To WP-Stats
- NEW: Added get_highest_score(), get_highest_score_category(), get_highest_score_range(), get_highest_score_range_category()
- NEW: Use _n() Instead Of __ngettext() And _n_noop() Instead Of __ngettext_noop()
- NEW: Uses New Widget Class From WordPress
- NEW: Merge Widget Code To wp-postratings.php And Remove wp-postratings-widget.php
- NEW: get_highest_rated_tag() And get_lowest_rated_tag()
- FIXED: Uses $_SERVER['PHP_SELF'] With plugin_basename(FILE) Instead Of Just $_SERVER['REQUEST_URI']
- FIXED: Ensure That Post Is Not A Revision
- FIXED: Missing + Sign For Thumbs Up/Down Ratings If Score Is Positive
- FIXED: Logged By Username Now Shows Ratings Results To Users Who Did Not Login
- FIXED: Multiple Loops Filtered Not Cleared
- NEW: Works For WordPress 2.7 Only
- NEW: Load Admin JS And CSS Only In WP-PostRatings Admin Pages
- NEW: Added postratings-admin-css.css For WP-PostRatings Admin CSS Styles
- NEW: Allow The Usage Of PNG Icons Or GIF Icons. See Usage Tab.*
- NEW: Added get_lowest_rated_range() Function
- NEW: Right To Left Language Support by Kambiz R. Khojasteh
- NEW: Added "postratings-css-rtl.css" by Kambiz R. Khojasteh
- NEW: Added 3 Functions For Creating HTML Code Of Rating Images by Kambiz R. Khojasteh
- NEW: Call postratings_textdomain() In create_ratinglogs_table() and process_ratings() by Kambiz R. Khojasteh
- NEW: Replaced Template Variable Calculations With expand_ratings_template() by Kambiz R. Khojasteh
- NEW: Added Filter expand_ratings_template For Localizing Digits by Kambiz R. Khojasteh
- NEW: Uses wp_register_style(), wp_print_styles(), plugins_url() And site_url()
- FIXED: SSL Support
- NEW: Works For WordPress 2.6
- NEW: Renamed GET Variables sortby To r_sortby And orderby To r_orderby
- NEW: Renamed postratings-admin-js.php To postratings-admin-js.js and Move The Dynamic Javascript Variables To The PHP Pages
- NEW: Renamed postratings-js.php To postratings-js.js and Move The Dynamic Javascript Variables To The PHP Pages
- NEW: Uses postratings-js-packed.js And postratings-admin-js-packed.js
- NEW: When Displaying The Ratings Given By Comment Author, It Check Against Cookie As Well As IP
- NEW: Better Translation Using __ngetext() by Anna Ozeritskaya
- FIXED: MYSQL Charset Issue Should Be Solved
- FIXED: Removed WP-Cache Compatibility As It Is Not Tested
- FIXED: Able To Use r_sortby And r_orderby in query_posts()
- NEW: Works For WordPress 2.5 Only
- NEW: Removed 'postratings-usage.php'
- NEW: Uses ShortCode API
- NEW: Splitted Templates From PostRating Options Into Its Own File, 'postratings-templates.php'
- NEW: Able To Display The Ratings Given By Comment Author When Displaying Comments
- NEW: WP-PostRatings Will Load 'postratings-css.css' Inside Your Theme Directory If It Exists. If Not, It Will Just Load The Default 'postratings-css.css' By WP-PostRatings
- NEW: Use number_format_i18n() Instead Of number_format()
- NEW: Added Get Most/Highest Rated Post Within A Given Time Range Function
- NEW: Added Get Most/Highest Rated Post By Category ID Within A Given Time Range Function
- NEW: Added get_lowest_rated() Function
- NEW: Added get_lowest_rated_category() Function
- NEW: Added get_most_rated_category() Function
- NEW: Get Most Rated Is Now Under The Templates
- NEW: Minimum Votes Options/Parameters Added To get_lowest_rated(), get_lowest_rated_category(), get_highest_rated(), get_highest_rated_category(), get_most_rated() and get_most_rated_category() Functions
- NEW: Uses /wp-postratings/ Folder Instead Of /postratings/
- NEW: Uses wp-postratings.php Instead Of postratings.php
- NEW: Move WP-PostRatings Stats Out Of postratings.php Into postrating-stats.php
- FIXED: Thumbs Up/Down Post Should Get Sorted By Score Instead Of Average
- FIXED: Increased The Length Of The Input Box For Individual Rating Value
- FIXED: Manage Ratings Does Not Display "Numbers" Style Rating
- FIXED: %POST_EXCERPT% Variable Is Sometimes Empty
- NEW: Works For WordPress 2.3 Only
- NEW: Ability To Embed [ratings=1] Into Post/Excerpt, Where 1 Is The ID Of The Post/Page Ratings You Want To Display
- NEW: Ability To Embed [ratings_results=1] Into Post/Excerpt, Where 1 Is The ID Of The Post/Page Ratings Results You Want To Display
- NEW: Ability To Support Mutiple Categories For get_highest_rated_category(). By: Dirceu P. Junior
- NEW: Ability To Embed [ratings] Into Excerpt
- NEW: Added Template For No Permission To Rate
- NEW: Ability To Filter Logs By Post ID, User and Rating
- NEW: Added heart, heart_crystal, plusminus, plusminus_crystal, stars_crystal, thumbs, tickcross, tickcross_crystal and updown_crystal Rating Styles
- NEW: Supports Up/Down Or Thumbs Up/Thumbs Down Rating
- NEW: Supports Custom Image For Individual Rating Scale
- NEW: WP-Cache Compatible By Nir Aides
- NEW: Highest Rated Widge And Most Rated Widget Added
- NEW: Ability To Uninstall WP-PostRatings
- NEW: Uses WP-Stats Filter To Add Stats Into WP-Stats Page
- FIXED: Some Translation Bug In postrating-usage.php
- NEW: Ratings Custom Fields Will Automatically Be Created With The Creation Of Each New Post/Page
- NEW: Added AJAX Style Option: "Show Loading Image With Text"
- NEW: Added AJAX Style Option: "Show Fading In And Fading Out Of Ratings"
- NEW: Removed Ratings From Feed If Ratings Is Embedded Into The Post Using [ratings]
- FIXED: Wrong URL For Page Under Top Rated/Highest Posts Listing
- FIXED: Next/Previous Paging Bug In WP-Admin -> Manage Ratings
- FIXED: Sort Most Rated Posts By Number Of Voters Followed By Post Average Ratings
- NEW: Works For WordPress 2.1 Only
- NEW: Renamed postratings-js.js To postratings-js.php To Enable PHP Parsing
- NEW: Added Function To Get Highest Rated Post By Category ID
- NEW: Added The Ability For Each Rating Star To Have Its Own Text
- NEW: Highest Rated Post Is Now In The Templates For Easy Modification
- NEW: Usage Instructions Is Also Included Within The Plugin Itself
- NEW: Able To Delete Ratings Logs And Data By Post IDs
- NEW: Able To Uninstall WP-PostRatings
- NEW: Localization WP-PostRatings
- FIXED: snippet_text() Function Missing
- FIXED: AJAX Not Working On Servers Running On PHP CGI
- FIXED: Highest Rated Post Is Now Based On The Ratings Followed By The Number Of Votes
- FIXED: Added Some Default Styles To postratings-css.css To Ensure That WP-PostRatings Does Not Break
- NEW: Ability To Logged By UserName
- NEW: get_highest_rated_sidebar(); To Display The Highest Rated Post On The Sidebar
- NEW: Added CSS Class 'post-ratings-image' To All IMG Tags
- FIXED: If Site URL Doesn't Match WP Option's Site URL, WP-PostRatings Will Not Work
- NEW: Total Rating Votes Stats And Total Rating Users Stats Function Added
- FIXED: Ratings Not Working On Physical Pages That Is Integrated Into WordPress
- FIXED: Modified Get Most/Highest Rated Post Function
- FIXED: Search Bots Unable To Index Site
- FIXED: AJAX Not Working In Opera Browser
- NEW: Fading In/Put Effect After You Rate A Post
- NEW: Rating Voting And Rating Results Are On The Same Image
- NEW: Added Rating Option For Logging Method
- NEW: Added Rating Option For Who Can Rate
- NEW: Added Rating Results Image To Get Highest Rated Stats
- NEW: Rating Administration Panel And The Code That WP-PostRatings Generated Is XHTML 1.0 Transitional
- NEW: AJAX Voting
- FIXED: Block Search Bots From Voting
- FIXED: Hard Coded Table Name In Ratings Stats
- NEW: Initial Release
- Open
wp-content/plugins
Folder - Put:
Folder: wp-PostRatings
- Activate
WP-PostRatings
Plugin - Go to
WP-Admin -> Ratings
- Open
wp-content/themes/<YOUR THEME NAME>/index.php
- You may place it in archive.php, single.php, post.php or page.php also.
- Find:
<?php while (have_posts()) : the_post(); ?>
- Add Anywhere Below It (The Place You Want The Ratings To Show):
<?php if(function_exists('the_ratings')) { the_ratings(); } ?>
- If you DO NOT want the ratings to appear in every post/page, DO NOT use the code above. Just type in
[ratings]
into the selected post/page content and it will embed ratings into that post/page only. - If you want to embed other post ratings use
[ratings id="1"]
, where 1 is the ID of the post/page ratings that you want to display. - If you want to embed other post ratings results, use
[ratings id="1" results="true"]
, where 1 is the ID of the post/page ratings results that you want to display.
- Deactivate
WP-PostRatings
Plugin - Open
wp-content/plugins
Folder - Put/Overwrite:
Folder: wp-postratings
- Activate
WP-PostRatings
Plugin - Go to
WP-Admin -> Ratings -> Ratings Templates
and restore all the template variables toDefault
- Go to
WP-Admin -> Appearance -> Widgets
and re-add the Ratings Widget
N/A
- Admin - Ratings Log Bottom
- Admin - Ratings Log Top
- Admin - Ratings Options
- Admin - Ratings Templates
- Ratings
- Ratings Hover
- The default schema type is 'Article', if you want to change it to 'Recipe', you need to make use of the
wp_postratings_schema_itemtype
filter as shown in the sample code below:
- Open
wp-content/plugins/wp-postratings/wp-postratings.php
- Find:
//add_filter('comment_text', 'comment_author_ratings_filter');
- Replace:
add_filter('comment_text', 'comment_author_ratings_filter');
- Open
wp-content/plugins/wp-postratings/wp-postratings.php
- Find:
define('RATINGS_IMG_EXT', 'gif');
//define('RATINGS_IMG_EXT', 'png');
3. Replace:
//define('RATINGS_IMG_EXT', 'gif');
define('RATINGS_IMG_EXT', 'png');
- WP-PostRatings will load
postratings-css.css
from your theme's directory if it exists. - If it doesn't exists, it will just load the default 'postratings-css.css' that comes with WP-PostRatings.
- This will allow you to upgrade WP-PostRatings without worrying about overwriting your ratings styles that you have created.
- Go to
WP-Admin -> Appearance -> Widgets
- The widget name is Ratings.
- Use:
* Default: get_lowest_rated('both', 0, 10)
* The value 'both' will display both the lowest rated posts and pages.
* If you want to display the lowest rated posts only, replace 'both' with 'post'.
* If you want to display the lowest rated pages only, replace 'both' with 'page'.
* The value 0 refers to the minimum votes required before the post get shown.
* The value 10 will display only the top 10 lowest rated posts/pages.
- Use:
* Default: get_lowest_rated_tag(TAG_ID, 'both', 0, 10)
* Replace TAG_ID will your tag ID. If you want it to span several categories, replace TAG_ID with array(1, 2) where 1 and 2 are your categories ID.
* The value 'both' will display both the lowest rated posts and pages.
* If you want to display the lowest rated posts only, replace 'both' with 'post'.
* If you want to display the lowest rated pages only, replace 'both' with 'page'.
* The value 0 refers to the minimum votes required before the post get shown.
* The value 10 will display only the top 10 lowest rated posts/pages.
- Use:
* Default: get_lowest_rated_category(CATEGORY_ID, 'both', 0, 10)
* Replace CATEGORY_ID will your category ID. If you want it to span several categories, replace CATEGORY_ID with array(1, 2) where 1 and 2 are your categories ID.
* The value 'both' will display both the lowest rated posts and pages.
* If you want to display the lowest rated posts only, replace 'both' with 'post'.
* If you want to display the lowest rated pages only, replace 'both' with 'page'.
* The value 0 refers to the minimum votes required before the post get shown.
* The value 10 will display only the top 10 lowest rated posts/pages.
- Use:
* Default: get_highest_rated('both', 0, 10)
* The value 'both' will display both the highest rated posts and pages.
* If you want to display the highest rated posts only, replace 'both' with 'post'.
* If you want to display the highest rated pages only, replace 'both' with 'page'.
* The value 0 refers to the minimum votes required before the post get shown.
* The value 10 will display only the top 10 highest rated posts/pages.
- Use:
* Default: get_highest_rated_tag(TAG_ID, 'both', 0, 10)
* Replace TAG_ID will your tag ID. If you want it to span several categories, replace TAG_ID with array(1, 2) where 1 and 2 are your categories ID.
* The value 'both' will display both the highest rated posts and pages.
* If you want to display the highest rated posts only, replace 'both' with 'post'.
* If you want to display the highest rated pages only, replace 'both' with 'page'.
* The value 0 refers to the minimum votes required before the post get shown.
* The value 10 will display only the top 10 highest rated posts/pages.
- Use:
* Default: get_highest_rated_category(CATEGORY_ID, 'both', 0, 10)
* Replace CATEGORY_ID will your category ID. If you want it to span several categories, replace CATEGORY_ID with array(1, 2) where 1 and 2 are your categories ID.
* The value 'both' will display both the highest rated posts and pages.
* If you want to display the highest rated posts only, replace 'both' with 'post'.
* If you want to display the highest rated pages only, replace 'both' with 'page'.
* The value 0 refers to the minimum votes required before the post get shown.
* The value 10 will display only the top 10 highest rated posts/pages.
- Use:
* Default: get_highest_rated_range('1 day', 'both', 10)
* The value '1 day' will be the range that you want. You can use '2 days', '1 month', etc.
* The value 'both' will display both the most rated posts and pages.
* If you want to display the most rated posts only, replace 'both' with 'post'.
* If you want to display the most rated pages only, replace 'both' with 'page'.
* The value 10 will display only the top 10 most rated posts/pages.
- Use:
* Default: get_most_rated('both', 0, 10)
* The value 'both' will display both the most rated posts and pages.
* If you want to display the most rated posts only, replace 'both' with 'post'.
* If you want to display the most rated pages only, replace 'both' with 'page'.
* The value 0 refers to the minimum votes required before the post get shown.
* The value 10 will display only the top 10 most rated posts/pages.
- Use:
* Default: get_most_rated_category(CATEGORY_ID, 'both', 0, 10)
* Replace CATEGORY_ID will your category ID. If you want it to span several categories, replace CATEGORY_ID with array(1, 2) where 1 and 2 are your categories ID.
* The value 'both' will display both the most rated posts and pages.
* If you want to display the most rated posts only, replace 'both' with 'post'.
* If you want to display the most rated pages only, replace 'both' with 'page'.
* The value 0 refers to the minimum votes required before the post get shown.
* The value 10 will display only the top 10 most rated posts/pages.
- Use:
* Default: get_most_rated_range('1 day', 'both', 10)
* The value '1 day' will be the range that you want. You can use '2 days', '1 month', etc.
* The value 'both' will display both the most rated posts and pages.
* If you want to display the most rated posts only, replace 'both' with 'post'.
* If you want to display the most rated pages only, replace 'both' with 'page'.
* The value 10 will display only the top 10 most rated posts/pages.
- Use:
* Default: get_highest_score('both', 0, 10)
* The value 'both' will display both the most rated posts and pages.
* If you want to display the most rated posts only, replace 'both' with 'post'.
* If you want to display the most rated pages only, replace 'both' with 'page'.
* The value 0 refers to the minimum votes required before the post get shown.
* The value 10 will display only the top 10 most rated posts/pages.
- Use:
* Default: get_highest_score_category(CATEGORY_ID, 'both', 0, 10)
* Replace CATEGORY_ID will your category ID. If you want it to span several categories, replace CATEGORY_ID with array(1, 2) where 1 and 2 are your categories ID.
* The value 'both' will display both the most rated posts and pages.
* If you want to display the most rated posts only, replace 'both' with 'post'.
* If you want to display the most rated pages only, replace 'both' with 'page'.
* The value 0 refers to the minimum votes required before the post get shown.
* The value 10 will display only the top 10 most rated posts/pages.
- Use:
* Default: get_highest_score_range('1 day', 'both', 10)
* The value '1 day' will be the range that you want. You can use '2 days', '1 month', etc.
* The value 'both' will display both the most rated posts and pages.
* If you want to display the most rated posts only, replace 'both' with 'post'.
* If you want to display the most rated pages only, replace 'both' with 'page'.
* The value 10 will display only the top 10 most rated posts/pages.
- You can use:
<?php query_posts( array( 'meta_key' => 'ratings_average', 'orderby' => 'meta_value_num', 'order' => 'DESC' ) ); ?>
- Or pass in the variables to the URL:
http://yoursite.com/?r_sortby=highest_rated&r_orderby=desc
- You can replace desc with asc if you want the lowest rated posts.
- You can use:
<?php query_posts( array( 'meta_key' => 'ratings_users', 'orderby' => 'meta_value_num', 'order' => 'DESC' ) ); ?>
- Or pass in the variables to the URL:
http://yoursite.com/?r_sortby=most_rated&r_orderby=desc
- You can replace desc with asc if you want the least rated posts.