<?php
/**
 * The template for displaying archive pages.
 *
 * @link https://codex.wordpress.org/Template_Hierarchy
 *
 * @package daohang
 */

get_header(); 
?>


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

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

			<div class="breadcrumbs no_zhuanti clear">
				<?php
					echo "<h1>";
						single_cat_title('');
					echo "</h1>";
				?>						
				<?php
					// Show an optional term description.
					$term_description = term_description();
					if ( ! empty( $term_description ) ) :
						printf( '<div class="taxonomy-description">%s</div>', $term_description );
					endif;
				?>				
			</div><!-- .breadcrumbs -->

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

			<?php

			if ( have_posts() ) :	
				$i = 1;		
				
				echo "<div class=\"posts-loop clear\">";

				/* Start the Loop */
				while ( have_posts() ) : the_post();

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


					if ( $i == get_theme_mod('content-ad-position', '1')+1 ) {
						if ( !empty(get_theme_mod('content-ad-1')) ) {
							echo '<div class="content-ad">';
							echo get_theme_mod('content-ad-1');
							echo '</div>';
						}
					}

					if ( $i == get_theme_mod('content-ad-position2', '4')+1 ) {
						if ( !empty(get_theme_mod('content-ad-2')) ) {
							echo '<div class="content-ad">';
							echo get_theme_mod('content-ad-2');
							echo '</div>';
						}
					}	

					if ( $i == get_theme_mod('content-ad-position3', '7')+1 ) {
						if ( !empty(get_theme_mod('content-ad-3')) ) {
							echo '<div class="content-ad">';
							echo get_theme_mod('content-ad-3');
							echo '</div>';
						}
					}	
						

					$i++;

				endwhile;
				
				echo "</div><!-- .post-loop -->";

				get_template_part( 'template-parts/pagination', '' ); 

			else :

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

			endif; 

			?>

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

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

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


<?php get_sidebar(); ?>

<?php get_footer(); ?>
