WordPress.org

Ready to get started?Download WordPress

Forums

WP-PostRatings
Exclude Categories (5 posts)

  1. evanthorpe
    Member
    Posted 1 year ago #

    Hi,

    We use WP-PostRatings on our site, but I'm hoping to be able to exclude certain categories from using the post rating system. Is there anything I can do to remove these categories from using the post ratings system?

    Thanks. Here is the code that is getting used to post those ratings to a post:

    <?php if(function_exists('the_ratings')) {//echo("<strong class=\"remark\">Rating: ".get_rating_remark(get_the_ID())."</strong>");the_ratings();} ?>

    Here's the site: http://www.lisasliquorbarn.com

    http://wordpress.org/extend/plugins/wp-postratings/

  2. evanthorpe
    Member
    Posted 1 year ago #

    Sorry, it seems like the code didn't properly show up:

    <?php
    									if(function_exists('the_ratings')) {
    										//echo("<strong class=\"remark\">Rating: ".get_rating_remark(get_the_ID())."</strong>");
    										the_ratings();
    									}
    							 ?>
  3. WordBuddyPress
    Member
    Posted 11 months ago #

    I have the same problem. I am quite new to coding for WordPress but after quick research I thought of maybe adding a category "norating" and then show the rating to all categories but "norating"
    like

    <?php
    foreach (get_the_category() as $category) {
        if ( $category->name !== 'norating' ) {
            if(function_exists('the_ratings')) {//echo("<strong class=\"remark\">Rating: ".get_rating_remark(get_the_ID())."</strong>");the_ratings();}
        }

    Thanks to this page

    PS I haven't tried it yet.

  4. WordBuddyPress
    Member
    Posted 11 months ago #

    I also deactivated the rating if the comments are disabled:

    <?php if ( comments_open() ) : ?>
     <?php if(function_exists('the_ratings')) { the_ratings(); } ?>
     <?php endif; // rating ?>
  5. WordBuddyPress
    Member
    Posted 11 months ago #

    didn't work my working code is (you can use the id or name of the category) in this case it is: if not in category narrating show rating. (other way around just take out the ! in front of the in_category).

    <?php if(!in_category( 'norating' )){
    			if(function_exists('the_ratings')) { the_ratings(); }
        } ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic