I need to calculate the average rating of the comment and place that value as a rating star at other page. For example. If the average rating value is "3 star". I want to print that value as "3 star image" and place that image at the another page. I asked this question in many site but not getting any answer. Please help me somebody
This is the URL
http://www.smashingmagazine.com/2012/05/08/adding-custom-fields-in-wordpress-comment-form/
$plugin_url_path = WP_PLUGIN_URL;
if( $commenttitle = get_comment_meta( get_comment_ID(), 'title', true ) ) {
$commenttitle = '<strong>' . esc_attr( $commenttitle ) . '</strong><br/>';
$text = $commenttitle . $text;
}
if( $commentrating = get_comment_meta( get_comment_ID(), 'rating', true ) ) {
$commentrating = '<p class="comment-rating"> <img src="'. $plugin_url_path .
'/ExtendComment/images/'. $commentrating . 'star.gif"/><br/>Rating: <strong>'. $commentrating .' / 5</strong></p>';
$text = $text . $commentrating;
return $text;
} else {
return $text;
}
}