lesterchan / wp-postratings

Adds an AJAX rating system for your WordPress blog's post/page.
https://wordpress.org/plugins/wp-postratings/
122 stars 82 forks source link
lesterchan rated-posts rating-widget ratings wordpress wordpress-plugin wp-postratings

WP-PostRatings

Contributors: GamerZ
Donate link: https://lesterchan.net/site/donation/
Tags: ratings, rating, postratings, postrating, vote, digg, ajax, post
Requires at least: 4.9.6
Tested up to: 6.6
Stable tag: 1.91.2

Adds an AJAX rating system for your WordPress site's content.

Description

Usage

  1. Open wp-content/themes/<YOUR THEME NAME>/index.php
  2. You may place it in archive.php, single.php, post.php or page.php also.
  3. Find: <?php while (have_posts()) : the_post(); ?>
  4. Add Anywhere Below It (The Place You Want The Ratings To Show): <?php if(function_exists('the_ratings')) { the_ratings(); } ?>

Development

https://github.com/lesterchan/wp-postratings

Credits

Donations

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.

Changelog

Version 1.91.2

Version 1.91.1

Version 1.91

Version 1.90.1

Version 1.90

Version 1.89.1

Version 1.89

Version 1.88

Version 1.87

Version 1.86.2

Version 1.86.1

Version 1.86

Version 1.85

Version 1.84.1

Version 1.84

Version 1.83.2

Version 1.83.1

Version 1.83

Version 1.82

Version 1.81

Version 1.80

Version 1.79

Version 1.78

Version 1.77

Version 1.76

Version 1.75

Version 1.74

Version 1.73

Upgrade Notice

N/A

Screenshots

  1. Admin - Ratings Log Bottom
  2. Admin - Ratings Log Top
  3. Admin - Ratings Options
  4. Admin - Ratings Templates
  5. Ratings
  6. Ratings Hover

Frequently Asked Questions

How To Change Schema Type?

<?php  
add_filter( 'wp_postratings_schema_itemtype', 'wp_postratings_schema_itemtype' );  
function wp_postratings_schema_itemtype( $itemtype ) {  
    return 'itemscope itemtype="http://schema.org/Recipe"';  
}  
?>

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 above.

How To Add Your Site Logo For Google Rich Snippets

<?php  
add_filter( 'wp_postratings_site_logo', 'wp_postratings_site_logo' );  
function wp_postratings_site_logo( $url ) {  
    return 'http://placehold.it/350/150.png';  
}  
?>

By default, the plugin will use your site header image URL as your site logo. If you want to change it, you need to make use of the wp_postratings_site_logo filter as shown in the sample code above.

How To Remove Ratings Image alt and title Text?

<?php  
add_filter( 'wp_postratings_ratings_image_alt', 'wp_postratings_ratings_image_alt' );  
function wp_postratings_ratings_image_alt( $alt_title_text ) {  
    return '';  
}  
?>

How To Display Comment Author Ratings?

add_filter( 'wp_postratings_display_comment_author_ratings', '__return_true' );

By default, the comment author ratings are not displayed. If you want to display the ratings, you need to make use of the wp_postratings_display_comment_author_ratings filter as shown in the sample code above.

How To use PNG images instead of GIF images?

function custom_rating_image_extension() {
    return 'png';
}
add_filter( 'wp_postratings_image_extension', 'custom_rating_image_extension' );

The default image extension if 'gif', if you want to change it to 'png', you need to make use of the wp_postratings_image_extension filter as shown in the sample code above.

How To change the cookie expiration time?

function custom_rating_cookie_expiration() {
    return strtotime( 'tomorrow' ) ;
}
add_filter( 'wp_postratings_cookie_expiration', 'custom_rating_cookie_expiration', 10, 0 );

The default cookie expiration if 'time() + 30000000', if you want to change the lenght of the experation, you need to make use of the wp_postratings_cookie_expiration filter as shown in the sample code above.

How Does WP-PostRatings Load CSS?

How To Use Ratings Stats With Widgets?

  1. Go to WP-Admin -> Appearance -> Widgets
  2. The widget name is Ratings.

To Display Lowest Rated Post

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

To Display Lowest Rated Post By Tag

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

To Display Lowest Rated Post In A Category

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

To Display Highest Rated Post

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

To Display Highest Rated Post By Tag

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

To Display Highest Rated Post In A Category

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

To Display Highest Rated Post Within A Given Period

<?php if (function_exists('get_highest_rated_range')): ?>
    <ul>
        <?php get_highest_rated_range('1 day'); ?>
    </ul>
<?php endif; ?>

To Display Most Rated Post

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

To Display Most Rated Post In A Category

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

To Display Most Rated Post Within A Given Period

<?php if (function_exists('get_most_rated_range')): ?>
    <ul>
        <?php get_most_rated_range('1 day'); ?>
    </ul>
<?php endif; ?>

To Display Highest Score Post

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

To Display Highest Score Post In A Category

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

To Display Highest Score Post Within A Given Period

<?php if (function_exists('get_highest_score_range')): ?>
    <ul>
        <?php get_highest_score_range('1 day'); ?>
    </ul>
<?php endif; ?>

To Sort Highest/Lowest Rated Posts

To Sort Most/Least Rated Posts