$elements_per_page, 'paged' => $paged, 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'category', 'field' => 'term_id', 'terms' => array( $portfolio_category ), ), array( 'taxonomy' => 'category', 'field' => 'term_id', 'terms' => array( $archive_category ), ), array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array( 'post-format-gallery', 'post-format-image' ), ), ) ); } else { $args = array( 'posts_per_page' => $elements_per_page, 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'category', 'field' => 'term_id', 'terms' => array( $archive_category ), ), array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array( 'post-format-gallery', 'post-format-image' ), ), ), 'paged' => $paged ); } } $archive_query = new WP_Query( $args ); $temp_query = $wp_query; $wp_query = null; $wp_query = $archive_query; $archive_alt_layout = get_theme_mod( 'portfolio_archive_alt_layout' ); if ( $archive_query->have_posts() ) { while ( $archive_query->have_posts() ) { $archive_query->the_post(); if ( $archive_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; ?>