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

get_header();

$theme_options = omag_theme_options();

$sidebar_class = '';

if( 'left' == $theme_options['sidebar'] ) {
  $sidebar_class = 'left-sidebar';
} else {
  $sidebar_class = '';
}

$grid_class= '';

if( 'grid' == $theme_options['post_view'] ){
	$grid_class= 'grid-view';	
}

?>

	<div class="container mb-view-container">

			<!-- News start -->

			<div class="row">



				<div class="col-lg-9 <?php echo esc_attr( $sidebar_class ); ?> <?php echo esc_attr( $grid_class ); ?>" id="right">
					<div class="site">
						<div class="site-inner">

							<?php do_action( 'omag_show_breadcrumbs' ); ?>

							<!-- First type of news -->

							<div class="site-content">

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


			<div class="article-title">

				<?php
					the_archive_title( '<h3 class="page-title"><span>', '</span></h3>' );
				?>
			</div>

			<?php
				the_archive_description( '<div class="archive-description">', '</div>' );
			?>

			<header class="page-header">
				
			</header><!-- .page-header -->

			<?php

			if( 'grid' == $theme_options['post_view'] ){
				echo '<div class="row">';
			}

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

				/*
				 * Include the Post-Type-specific template for the content.
				 * If you want to override this in a child theme, then include a file
				 * called content-___.php (where ___ is the Post Type name) and that will be used instead.
				 */

              		if( 'grid' == $theme_options['post_view'] ){

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

					} else {

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

					}

			endwhile;

			if( 'grid' == $theme_options['post_view'] ){
				echo '</div>';
			}

			if( 'numeric' == $theme_options['pagination_style'] ) {
                the_posts_pagination( 
					array(
						'mid_size' 	=> 2,
						'prev_text' => __( '&laquo; Previous', 'omag' ),
						'next_text' => __( 'Next &raquo;', 'omag' ),
					) 
				);
            } else {
              	the_posts_navigation();
            }

		else :

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

		endif;
		?>

		</div>

							<!-- First type of news end -->

						</div>
					</div>
				</div>




				<div class="col-lg-3" id="left">
					<div class="sidebar">
						<section>

<?php
get_sidebar();
?>

</section>
					</div>
				</div>



</div>

			<!-- News end -->
		</div>

<?php
get_footer();
