Esempio n. 1
0
 /**
  * Output the rating percentage in the column
  *
  * @param $column_name
  * @param $post_id
  */
 public function column_content($column_name, $post_id)
 {
     if ($column_name !== 'wpkb-rating') {
         return;
     }
     $rating = $this->rating->get_post_rating_perc($post_id);
     if ($rating === 0) {
         echo '-';
         return;
     }
     $color = $this->percent2Color($rating, 200);
     echo sprintf('<span style="color: #%s">%s%%</span> (%d)', $color, $rating, count($this->rating->get_post_ratings($post_id)));
 }