Calculating Bayesian average for custom post type
This is the (updated) code I’m using, which gives results like I’d expect: $args = array( ‘post_type’ => ‘entry’, ‘orderby’ => ‘bayesian_average’, ‘order’ => ‘DESC’, ‘post_status’ => ‘publish’ ); $loop = new WP_Query($args); $number_of_entrants = $loop->post_count; $total_ratings = $total_num_votes = 0; foreach ($loop->posts as $query_post) { $count = $query_post->ratings_count; $average = $query_post->ratings_average; $total_num_votes += $count; … Read more