WP Review Site Plugin Documentation

  1. Installation Guides

  2. Plugin Function Reference

Installation Guide

Installing WP Review Site is easy and should take just a few minutes:

Plugin Function Reference

  • ratings_table($custom_id = null)

    Outputs a table with average ratings for the current post. This function can be called within The Loop with no arguments, or outside The Loop by specifying the ID of the post to display ratings for.

    Usage Example:

    <?php if (function_exists('ratings_table')) ratings_table(); ?>

    Output Example:

    <table class="ratings">
        <tr><td class="rating_label">Price</td><td class="rating_value"><img src="/wp-content/plugins/review-site/star.gif" />...</td></tr>
    
        <tr><td class="rating_label">Support</td><td class="rating_value"><img src="/wp-content/plugins/review-site/star.gif" />...</td></tr>
        <tr><td class="rating_label">Reliability</td><td class="rating_value"><img src="/wp-content/plugins/review-site/star.gif" />...</td></tr>
    </table>
  • ratings_list($custom_id = null)

    Outputs an unordered list with average ratings for the current post. This function can be called within The Loop with no arguments, or outside The Loop by specifying the ID of the post to display ratings for.

    Usage Example:

    <?php if (function_exists('ratings_list')) ratings_list(); ?>

    Output Example:

    <ul class="ratings">
        <li><label class="rating_label">Price</label> <span class="rating_value"><img src="/wp-content/plugins/review-site/star.gif" />...</span></li>
        <li><label class="rating_label">Support</label> <span class="rating_value"><img src="/wp-content/plugins/review-site/star.gif" />...</span></li>
        <li><label class="rating_label">Reliability</label> <span class="rating_value"><img src="/wp-content/plugins/review-site/star.gif" />...</span></li>
    </ul>
  • get_ratings($custom_id = null)

    Returns an array with average ratings for the current post. This function can be called within The Loop with no arguments, or outside The Loop by specifying the ID of the post to display ratings for. Since the array contains numeric values for each dimension posts or pages are rated on, you may use num_to_stars() to convert this number to star graphics.

    Usage Example:

    <?php if (function_exists('get_ratings')) $ratings = get_ratings(); ?>

    Output Example:
    This function has no output. The array returned has the following format:

    array(
        [Price] => 3.5,
        [Support] => 2.5,
        [Reliability] => 3.2
    )
  • positive_reviews($custom_id = null)

    Displays the number of unique reviews of the current post with an average rating of 3 stars or higher.

    Usage Example:

    <?php if (function_exists('positive_reviews')) echo positive_reviews(); ?> Positive Reviews

    Output Example:

    8 Positive Reviews
  • negative_reviews($custom_id = null)

    Displays the number of unique reviews of the current post with an average rating of less than 3 stars.

    Usage Example:

    <?php if (function_exists('negative_reviews')) echo negative_reviews(); ?> Negative Reviews

    Output Example:

    2 Negative Reviews
  • get_positive_negative_count($custom_id = null)

    Returns an array with the number of positive (3 star or higher) and negative reviews received by the current post.

    Usage Example:

    <?php if (function_exists('get_positive_negative_count')) $counts = get_positive_negative_count(); ?>

    Output Example:
    This function has no output. The array returned has the following format:

    array(
        [positive] => 8,
        [negative] => 2
    )
  • comment_ratings_table($custom_id = null)

    Outputs a table with ratings submitted with the specified comment. This function can be called within the comments loop in comments.php with no arguments, or outside the loop by specifying the ID of the comment to display ratings for. If used within a comment display loop, it expects the current comment to be called $comment.

    Usage Example:

    <?php if (function_exists('comment_ratings_table')) comment_ratings_table(); ?>

    Output Example:

    <table class="ratings">
        <tr><td class="rating_label">Price</td><td class="rating_value"><img src="/wp-content/plugins/review-site/star.gif" />...</td></tr>
        <tr><td class="rating_label">Support</td><td class="rating_value"><img src="/wp-content/plugins/review-site/star.gif" />...</td></tr>
        <tr><td class="rating_label">Reliability</td><td class="rating_value"><img src="/wp-content/plugins/review-site/star.gif" />...</td></tr>
    </table>
  • comment_ratings_list($custom_id = null)

    Outputs an unordered list with ratings submitted with the specified comment. This function can be called within the comments loop in comments.php with no arguments, or outside the loop by specifying the ID of the comment to display ratings for. If used within a comment display loop, it expects the current comment to be called $comment.

    Usage Example:

    <?php if (function_exists('comment_ratings_list')) comment_ratings_list(); ?>

    Output Example:

    <ul class="ratings">
        <li><label class="rating_label">Price</label> <span class="rating_value"><img src="/wp-content/plugins/review-site/star.gif" />...</span></li>
        <li><label class="rating_label">Support</label> <span class="rating_value"><img src="/wp-content/plugins/review-site/star.gif" />...</span></li>
        <li><label class="rating_label">Reliability</label> <span class="rating_value"><img src="/wp-content/plugins/review-site/star.gif" />...</span></li>
    </ul>
  • ratings_input_table($custom_id = null)

    Outputs a table which collects ratings within the comment form of a post or page. Includes HTML which displays a table containing the dimensions you want to collect ratings for (ex: “value”, “support”, “reliability”) as well as JavaScript star rating widgets that allow ratings to be set by clicking on star images. Must be used between the <form> and </form> tags in comments.php for ratings to be submitted along with the comment.

    Usage Example:

    <?php if (function_exists('ratings_input_table')) ratings_input_table(); ?>

    Output Example:

    <table class="ratings">
    <tr>
    	<td class="rating_label">Features</td>
    	<td class="rating_value">
    		<a onclick="rateIt(this, 0)" id="0_1" title="1" onmouseover="rating(this, 0)" onmouseout="rolloff(this, 0)"></a>
    		<a onclick="rateIt(this, 0)" id="0_2" title="2" onmouseover="rating(this, 0)" onmouseout="rolloff(this, 0)"></a>
    		<a onclick="rateIt(this, 0)" id="0_3" title="3" onmouseover="rating(this, 0)" onmouseout="rolloff(this, 0)"></a>
    		<a onclick="rateIt(this, 0)" id="0_4" title="4" onmouseover="rating(this, 0)" onmouseout="rolloff(this, 0)"></a>
    		<a onclick="rateIt(this, 0)" id="0_5" title="5" onmouseover="rating(this, 0)" onmouseout="rolloff(this, 0)"></a>
    		<input type="hidden" id="0_rating" name="0_rating" value="0" />
    	</td>
    </tr>
    <tr>
    	<td class="rating_label">Support</td>
    	<td class="rating_value">
    		<a onclick="rateIt(this, 1)" id="1_1" title="1" onmouseover="rating(this, 1)" onmouseout="rolloff(this, 1)"></a>
    		<a onclick="rateIt(this, 1)" id="1_2" title="2" onmouseover="rating(this, 1)" onmouseout="rolloff(this, 1)"></a>
    		<a onclick="rateIt(this, 1)" id="1_3" title="3" onmouseover="rating(this, 1)" onmouseout="rolloff(this, 1)"></a>
    		<a onclick="rateIt(this, 1)" id="1_4" title="4" onmouseover="rating(this, 1)" onmouseout="rolloff(this, 1)"></a>
    		<a onclick="rateIt(this, 1)" id="1_5" title="5" onmouseover="rating(this, 1)" onmouseout="rolloff(this, 1)"></a>
    		<input type="hidden" id="1_rating" name="1_rating" value="0" />
    	</td>
    </tr>
    </table>
  • ratings_input_list($custom_id = null)

    Outputs an unordered list which collects ratings within the comment form of a post or page. Includes HTML which displays a list containing the dimensions you want to collect ratings for (ex: “value”, “support”, “reliability”) as well as JavaScript star rating widgets that allow ratings to be set by clicking on star images. Must be used between the <form> and </form> tags in comments.php for ratings to be submitted along with the comment.

    Usage Example:

    <?php if (function_exists('ratings_input_list')) ratings_input_list(); ?>

    Output Example:

    <ul class="ratings">
    <li>
    	<label class="rating_label" style="float: left">Features</label>
    	<div class="rating_value">
    		<a onclick="rateIt(this, 0)" id="0_1" title="1" onmouseover="rating(this, 0)" onmouseout="rolloff(this, 0)"></a>
    		<a onclick="rateIt(this, 0)" id="0_2" title="2" onmouseover="rating(this, 0)" onmouseout="rolloff(this, 0)"></a>
    		<a onclick="rateIt(this, 0)" id="0_3" title="3" onmouseover="rating(this, 0)" onmouseout="rolloff(this, 0)"></a>
    		<a onclick="rateIt(this, 0)" id="0_4" title="4" onmouseover="rating(this, 0)" onmouseout="rolloff(this, 0)"></a>
    		<a onclick="rateIt(this, 0)" id="0_5" title="5" onmouseover="rating(this, 0)" onmouseout="rolloff(this, 0)"></a>
    		<input type="hidden" id="0_rating" name="0_rating" value="0" />
    	</div>
    </li>
    <li>
    	<label class="rating_label" style="float: left">Support</label>
    	<div class="rating_value">
    		<a onclick="rateIt(this, 1)" id="1_1" title="1" onmouseover="rating(this, 1)" onmouseout="rolloff(this, 1)"></a>
    		<a onclick="rateIt(this, 1)" id="1_2" title="2" onmouseover="rating(this, 1)" onmouseout="rolloff(this, 1)"></a>
    		<a onclick="rateIt(this, 1)" id="1_3" title="3" onmouseover="rating(this, 1)" onmouseout="rolloff(this, 1)"></a>
    		<a onclick="rateIt(this, 1)" id="1_4" title="4" onmouseover="rating(this, 1)" onmouseout="rolloff(this, 1)"></a>
    		<a onclick="rateIt(this, 1)" id="1_5" title="5" onmouseover="rating(this, 1)" onmouseout="rolloff(this, 1)"></a>
    		<input type="hidden" id="1_rating" name="1_rating" value="0" />
    	</div>
    </li>
    </ul>
  • num_to_stars($num)

    Returns an HTML fragment containing star images depicting a numeric rating between 0 and 5. Values are rounded down to the nearest half star.

    Usage Example:

    <?php echo num_to_stars(3.8); ?>

    Output Example:

    <img src="/wp-content/plugins/review-site/star.gif" alt="3.8" />
    <img src="/wp-content/plugins/review-site/star.gif" alt="3.8" />
    <img src="/wp-content/plugins/review-site/star.gif" alt="3.8" />
    <img src="/wp-content/plugins/review-site/star-half.gif" alt="3.8" />
    <img src="/wp-content/plugins/review-site/star-empty.gif" alt="3.8" />
  • visit_site_link($text)

    Displays a link to the URL saved on the post or page edit screen for the current post or page. Specify the link text with the first parameter, or “Visit This Site” will be printed by default.

    Usage Example:

    <?php visit_site_link('Visit This Web Host'); ?>

    Output Example:

    <a href="http://www.example.com/affiliate/?affid=12345">Visit This Web Host</a>