'5', 'type' => 'star', 'color' => '#fde16d', ), $atts ) ); global $current_user; global $wpdb; get_currentuserinfo(); $table_name = $wpdb->prefix . "ratings"; $user_id = $current_user->ID; $post_id = get_the_ID(); ?> get_row("SELECT * FROM $table_name WHERE user_id = $user_id AND post_id = $post_id "); if ($check_rating) { $rated_text = esc_attr(get_option('rated_text')); if ($rated_text=="") { $rated_text = "You have already rated this post"; } echo "

".$rated_text."

"; ?> prefix . "ratings"; $get_rating_count = $wpdb->get_row("SELECT SUM(rating_value) as rat FROM $table_name WHERE post_id = $post_id"); $grc = $get_rating_count->rat; $get_rating_count1 = $wpdb->get_row("SELECT COUNT(*) as ratcount FROM $table_name WHERE post_id = $post_id"); $grc1 = $get_rating_count1->ratcount; if ( $grc1) { $avgrat = $grc / $grc1; $avgrat = number_format($avgrat, 1); } else { $avgrat = 0; } ?>

Please login to give rating