Esempio n. 1
0
function csr_the_comment_rating($comment_id = 0)
{
    echo apply_filters('csr_the_comment_rating', csr_get_comment_rating($comment_id));
}
 public static function get_overall_rating($post_id = null)
 {
     global $post;
     if ($post_id) {
         $post = get_post($post_id);
     }
     $comments = get_comments(array('post_id' => $post->ID));
     $count = 0;
     $total = 0;
     foreach ($comments as $comment) {
         if (csr_has_comment_rating($comment->comment_ID)) {
             $count++;
             $total += csr_get_comment_rating($comment->comment_ID);
         }
     }
     return $count > 0 ? $total / $count : null;
 }