<?php
/**
   * The template for Arhive.
   *
   *
   * @package   igor WordPress Theme
   * @copyright Copyright (C) 2016, OrdaSoft
   * @license  http://www.gnu.org/licenses/gpl-2.0.html  GNU General Public License v2 or later
   * @author    AUTHOR <www.ordasoft.com>
   * igor is distributed under the terms of the GNU GPL
*/
  $sidebar_left = false;
if (is_active_sidebar( 'sidebar_left' ) ) {
    $sidebar_left = true;
}

igor_header();
?>
<div id="primary" class="content-area">
    <div id="content" class="site-content" role="main">

        <div class="row">
            <?php if (is_active_sidebar( 'sidebar_left' ) ) : ?>
            <div class="widgets col-lg-8 col-md-8 col-sm-8 col-xs-12">
                <article id="sidebar-left" class="sidebar">
                    <?php  dynamic_sidebar('sidebar_left'); ?>
                </article>
            </div>
            <?php endif; ?>

            <?php if($sidebar_left) :
                echo ('<div class="col-lg-8 col-md-8 col-sm-8 col-xs-12">');
                echo ('<div class="archive">');
            else :
                echo ('<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">');
                echo ('<div class="archive container">');
            endif; ?>
                <header class="archive-header">
                    <h2 class="page-title"><?php printf( __( '%s Archives', 'igor' ), '<span>' . get_post_format_string( get_post_format() ) . '</span>' ); ?></h2>
                </header><!-- .archive-header -->
                <?php $position = 0; ?>
                <?php if ( have_posts() ) : ?>
                    <?php while ( have_posts() ) : the_post();

                         if ( $position % 1==0 ) { ?>
                                <div class="row">
                                <?php } ?>
                                    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 loop-item">
                                    <?php get_template_part( 'template-parts/content', get_post_format() ); ?>
                                    </div>
                                <?php $position++;
                                if ($position != 0 and $position % 1==0) { ?>
                                </div>
                                <?php } ?>


                   <?php endwhile; ?>

                <?php  the_posts_pagination();

                 else :

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

                 endif; ?>
            </div>
            </div>
            </div>

    </div>
</div><!-- #main -->
<?php get_footer(); ?>