$elements_per_page, 'paged' => $paged, 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'category', 'field' => 'term_id', 'terms' => array( $archive_category ), 'operator' => 'NOT IN' ), array( 'taxonomy' => 'category', 'field' => 'term_id', 'terms' => array( $portfolio_category ), ), array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array( 'post-format-gallery', 'post-format-image' ), ), ) ); } else { $args = array( 'posts_per_page' => $elements_per_page, 'paged' => $paged, 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'category', 'field' => 'term_id', 'terms' => array( $archive_category ), 'operator' => 'NOT IN' ), array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array( 'post-format-gallery', 'post-format-image' ), ), ) ); } $portfolio_query = new WP_Query( $args ); $temp_query = $wp_query; $wp_query = null; $wp_query = $portfolio_query; $portfolio_alt_layout = get_theme_mod( 'portfolio_alt_layout' ); if ( $portfolio_query->have_posts() ) { while ( $portfolio_query->have_posts() ) { $portfolio_query->the_post(); if ( $portfolio_alt_layout == 'checked' ) { get_template_part( 'template-parts/content', 'portfolio-element-alt' ); } else { get_template_part( 'template-parts/content', 'portfolio-element' ); } } } wp_reset_postdata(); the_posts_pagination( array( 'type' => 'list' ) ); $wp_query = null; $wp_query = $temp_query; ?>