<?php
/**
 * The template for displaying archive pages
 *
 * @package WP Fashion Storefront
 */

get_header();
?>

<?php $wp_fashion_storefront_archive_layout = get_theme_mod( 'wp_fashion_storefront_archive_layout', 'layout-1' ); ?> 

<div class="container">
	<?php
	if ( $wp_fashion_storefront_archive_layout == 'layout-1' ) {
		?>
	<div class="main-wrapper">
		<main id="primary" class="site-main ct-post-wrapper lay-width">

			<?php if ( have_posts() ) : ?>

				<?php wp_fashion_storefront_breadcrumbs(); ?>

				<header class="page-header">
					<?php
					the_archive_title( '<h1 class="page-title">', '</h1>' );
					the_archive_description( '<div class="archive-description">', '</div>' );
					?>
				</header>

				<?php
				while ( have_posts() ) :
					the_post();

					get_template_part( 'revolution/template-parts/content', get_post_format() );

				endwhile;

				?><?php
					$wp_fashion_storefront_pagination_wrap = absint(get_theme_mod('wp_fashion_storefront_enable_pagination', 1));
					$pagination_type = get_theme_mod('wp_fashion_storefront_pagination_type', 'type-1');

					if ($wp_fashion_storefront_pagination_wrap == 1) {
						if ($pagination_type == 'type-1') {
							the_posts_pagination();
						} elseif ($pagination_type == 'type-2') {
							the_posts_navigation();
						}
					}
				?><?php

			else :

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

			endif;
			?>
		</main>
		<?php get_sidebar(); ?>
	</div>
	<?php
	} elseif ( $wp_fashion_storefront_archive_layout == 'layout-2' ) {
		?>
	<div class="main-wrapper">
		<?php get_sidebar(); ?>
		<main id="primary" class="site-main ct-post-wrapper lay-width">

			<?php if ( have_posts() ) : ?>

				<?php wp_fashion_storefront_breadcrumbs(); ?>

				<header class="page-header">
					<?php
					the_archive_title( '<h1 class="page-title">', '</h1>' );
					the_archive_description( '<div class="archive-description">', '</div>' );
					?>
				</header>

				<?php
				while ( have_posts() ) :
					the_post();

					get_template_part( 'revolution/template-parts/content', get_post_format() );

				endwhile;

				?><?php
					$wp_fashion_storefront_pagination_wrap = absint(get_theme_mod('wp_fashion_storefront_enable_pagination', 1));
					$pagination_type = get_theme_mod('wp_fashion_storefront_pagination_type', 'type-1');

					if ($wp_fashion_storefront_pagination_wrap == 1) {
						if ($pagination_type == 'type-1') {
							the_posts_pagination();
						} elseif ($pagination_type == 'type-2') {
							the_posts_navigation();
						}
					}
				?><?php

			else :

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

			endif;
			?>
		</main>
	</div>
	<?php 
	} elseif ( $wp_fashion_storefront_archive_layout == 'layout-3' ) { // No-sidebar layout
	?>
	<div class="main-wrapper full-width">
		<main id="primary" class="site-main ct-post-wrapper lay-width">

			<?php if ( have_posts() ) : ?>

				<?php wp_fashion_storefront_breadcrumbs(); ?>

				<header class="page-header">
					<?php
					the_archive_title( '<h1 class="page-title">', '</h1>' );
					the_archive_description( '<div class="archive-description">', '</div>' );
					?>
				</header>

				<?php
				while ( have_posts() ) :
					the_post();

					get_template_part( 'revolution/template-parts/content', get_post_format() );

				endwhile;

				?><?php
					$wp_fashion_storefront_pagination_wrap = absint(get_theme_mod('wp_fashion_storefront_enable_pagination', 1));
					$pagination_type = get_theme_mod('wp_fashion_storefront_pagination_type', 'type-1');

					if ($wp_fashion_storefront_pagination_wrap == 1) {
						if ($pagination_type == 'type-1') {
							the_posts_pagination();
						} elseif ($pagination_type == 'type-2') {
							the_posts_navigation();
						}
					}
				?><?php

			else :

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

			endif;
			?>
		</main>
	</div>
	<?php } ?>
</div>

<?php
get_footer();
