Support » Plugin: WP-PostRatings » [Plugin: WP-PostRatings] Exclude Categories

  • 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:

Viewing 4 replies - 1 through 4 (of 4 total)
  • Sorry, it seems like the code didn’t properly show up:

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

    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”

    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.

    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 ?>

    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(); }
        } ?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: WP-PostRatings] Exclude Categories’ is closed to new replies.