<?php
/**
 * The template for displaying archive pages
 *
 * @link    https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package wpstream-theme
 */

get_header();
$selected_item_post_type	=	get_query_var( 'item_post_type','');
$wpstream_page_sidebar 		= 	intval(	get_theme_mod( 'wpstream_archive_sidebar', 'yes' ) );
$current_term     		    = 	get_query_var( 'term' );
wpstream_load_player_js_on_demand();
?>

<div class="wpstream_archive_header_holder ">

				<!-- Header -->
				<div class="wpstream_archive_header_title_wrapper ">
					<?php
					$current_taxonomy = get_query_var( 'taxonomy' );
			

					if ( '' === $current_taxonomy ) {
						if ( is_category() ) {
							$current_taxonomy = 'category';
							$category = get_queried_object();
							$current_term         = $category->name;
						} elseif ( is_tag() ) {
							$current_taxonomy = 'post_tag';
							$current_tag      = get_queried_object();
							$current_term     = $current_tag->name;
						} elseif ( is_month() ) {
                            $current_taxonomy = 'date';
                            $current_term     = get_the_date('F Y');
                        }
					}

					?>
					<?php the_archive_title( '<h1>', '</h1>' ); ?>
					<?php the_archive_description( '<div class="archive-description col-md-9">', '</div>' ); ?>
				</div>


</div>




	<div id="content" class="site-content <?php echo esc_attr( wpstream_theme_container_class() ); ?>">
		<div id="primary" class="content-area">

			<?php wpstream_bs_after_primary(); ?>

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

	

				<!-- Post List -->
				<div class="row">
					<?php if ( 1 === $wpstream_page_sidebar ) { ?>
						<div class="col col-md-8 col-lg-9 row wpstream-grid-container">
					<?php } else { ?>
						<div class="col col-md-12 col-lg-12 row wpstream-grid-container">
					<?php } ?>	
						<!-- Grid Layout -->

						<?php
						if ( '' !== $current_taxonomy ) {
							print wpstream_create_archive_lists( $current_taxonomy, $current_term    ,$selected_item_post_type );
						}
						?>


					</div>
					<!-- col -->
					<?php if ( 1 === $wpstream_page_sidebar ) {
						get_sidebar();
					 } ?>
				</div>
				<!-- row -->
			</main><!-- #main -->

		</div>
	</div>

<?php
get_footer();
