<?php get_header(); ?>	

	<div id="primary" class="content-area clear">	

		<main id="main" class="site-main clear">		

			<div id="recent-content" class="content-loop">

				<?php

				// Define custom query args
				$custom_query_args = array( 
	  				'paged' => get_query_var('paged')
				);  
				// globalize $wp_query
				global $wp_query;
				// Merge custom args with default query args
				$merged_query_args = array_merge( $wp_query->query, $custom_query_args );
				// process the query
				query_posts( $merged_query_args );

				if ( $wp_query->have_posts() ) :	
				
				$i = 1;

				/* Start the Loop */
				while ( $wp_query->have_posts() ) : $wp_query->the_post();

					get_template_part('template-parts/content', 'loop');

					if ( $i == 2 ) {
						dynamic_sidebar('archive-ad-1');
					}

					if ( $i == 8 ) {
						dynamic_sidebar('archive-ad-2');
					}

					$i++; 

				endwhile;

				else :

					get_template_part( 'template-parts/content', 'none' );

				endif; 

				?>

			</div><!-- #recent-content -->		

			<?php get_template_part( 'template-parts/pagination', '' ); ?>

		</main><!-- .site-main -->

	</div><!-- #primary -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>
