Support » Plugin: Post Ratings » [Plugin: Post Ratings] Ability to add post ratings only on posts in a category

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author digitalnature

    (@digitalnature)

    A) Already there, by default ratings are added to all posts.

    B) There’s no option for this, but it’s easily possible by hooking a filter on the post_ratings_visibility tag, in which you return false if the current category is not the right one.

    C) Already implemented, you can insert the [rate] shortcode into the post to show the rating links

    While I don’t mind implemented functionality that is in high demand, what really sparks my interest in this plugin is the simplicity and minimalistic approach. I just hope it won’t escape it’s purpose and end up “bloated with useless functionality”.

    Although, on a side note it would be handy to allow manually placing the ratings in templates via a function call.

    Hi digitalnature.

    B) Can you shed some light on how to get this done.

    The plugin is lightweight I presume.. would be good if it can be properly customized to ones own site requirements.

    Plugin Author digitalnature

    (@digitalnature)

    For example, for the “Uncategorized” category:

    add_filter('post_ratings_visibility', 'rate_only_my_category');
    
    function rate_only_my_category(){
    
      $categories = get_the_category();
    
      foreach($categories as $category)
        if($category->name === 'Uncategorized') return true;
    
      // don't display
      return false;
    }

    I’m hesitating to add the ability to visually choose the category context too, for the reasons SeancoJr mentioned…

    @digitalnature: No need to hesitate. You’re the developer. Those are only my opinions and I was basing it off what’s written in your plugin description. 😉

    Hi , is there a way for the same widget to be used multiple times to show results for specific cats? Does this work for MU?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Post Ratings] Ability to add post ratings only on posts in a category’ is closed to new replies.