Can’t increase posts_per_page by variable

All right, I think I see what’s going on… As per WP pagination parameters documentation, posts_per_page is indeed cached. Somewhat… Basically, you could set this to “10” the first time, as you do, and then to 5 after that, but then use “offset” or “paged” parameters to get the posts you want. Your “load-next-amount” variable … Read more

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