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

WP_Query that filters based on custom relationship field

well, I guess the problem is I’m trying to compare an array with a value. I made a workaround that gets me to where I need to go: <?php $client = get_field(‘client_name’); $work_args = array( ‘post_type’ => ‘work’ ); $work_query = new WP_Query($work_args); if ($work_query->have_posts()): while ($work_query->have_posts()): $work_query->the_post(); ?> $client2 = get_field(‘client_name’); if ($client[0] == … Read more

Custom Taxonomy Creates Unwanted Integer Terms on Post Save

This appears to be a result of the conflict between declaring a non-hierarchical custom taxonomy, and using the post_categories_meta_box (checkboxes) as an interface. You could call the discrepancy a bug in WP Core, certainly the fact that the conflict is allowed in the taxonomy declaration itself. The problem seems to be that for your non-hierarchical … Read more

How to fetch custom post by Author?

You are using ‘author’ => … twice in your code. To get the author’s ID, you should use get_the_author_meta(‘ID’) instead. So, remove the second author argument, and use this in your code: $author = get_the_author_meta(‘ID’); $args = array( ‘posts_per_page’ => $per_page, ‘author’=> $author, ‘post_type’ => ‘ultimate-auction’, //’auction-status’ => ‘expired’, ‘post_status’ => ‘publish’, ‘offset’ => $pagination, … Read more