Exclude posts from main loop based on meta value

Dave, your code seems good except a couple things in it, so please try it: function exclude_featured_post( $query ) { if ( is_front_page() && $query->is_main_query() ) { $meta_query = $query->get(‘meta_query’) ? $query->get(‘meta_query’) : array(); // append yours $meta_query[] = array( ‘key’ => ‘featured_post’, // please make sure that key is correct ‘value’ => ‘1’, ‘compare’ … Read more

1/3 of posts different class

The explanation is in the comments: <?php … if ( $query->have_posts() ) : //number of small ones needed = a third of total number of posts $numsmallneeded = round($query->post_count / 3); … while ( $query->have_posts() ) : $query->the_post(); //if no more small sizes are needed, use big if ( !$numsmallneeded ) $size = 1; //if … Read more

WP Query with categories only shows one post and ignores the category

Try this: ` $paged = ( get_query_var( ‘paged’ ) ) ? get_query_var( ‘paged’ ) : 1; $genral_args = array( ‘posts_per_page’ => ’50’, ‘post_type’ => ‘documents’, ‘cat’ => ‘your-category-id’, ‘paged’ => $paged ); $genral_query = new WP_Query( $genral_args ); while ( $genral_query->have_posts() ) : $genral_query->the_post(); ?> <?php //If we have the posts… if (the_field (‘title’)) : … Read more