The first 6 queries can be condensed to a single WP_Query
:
$args = array(
'cat' => 3598,
'posts_per_page' => 6
);
$featured = new WP_Query( $args );
if( $featured->have_posts() ){
$featured->the_post();
?>
your markup for the first post
<?php
$featured->the_post();
?>
your markup for the second post
<?php
$featured->the_post();
// etc..
wp_reset_postdata();
}
For the main query, use the pre_get_posts
action with a function in your theme’s functions.php
. This avoids wasting a query when you overwrite it in the template.
function wpa_exclude_categories( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( 'category__not_in', array( 683, 3598 ) );
}
}
add_action( 'pre_get_posts', 'wpa_exclude_categories' );
You’ve now chopped 6 queries from every page load, and your pagination will magically work, do a little dance.