<?php
/**
 * The main template file
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists.
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package dexen
 */

get_header();

$blog_post_list_sidebar = dexen_get_options('blog_post_list_sidebar');


if (is_active_sidebar('sidebar-1') && $blog_post_list_sidebar == '1' ) :
	$blog_class = 'col-lg-8';
else :
	$blog_class = 'col-lg-12';
endif;
?>

    <!--Sidebar Page Container-->
	<section class="blog-one sec-pad">
        <div class="container">                
            <div class="row">
				<div class="<?php echo esc_attr($blog_class); ?>">
					<div class="row">
					<?php
						if (have_posts()) :
							
							while (have_posts()) :
								the_post();
								get_template_part('template-parts/content', get_post_format());

							endwhile;
						else :
							get_template_part('template-parts/content', 'none');
						endif;
					?>
					</div>

					<?php
                     $pagination_blog = get_the_posts_pagination();
					 if($pagination_blog) : ?>
						<div class="col-md-12">
							<div class="blog-post-pagination text-center">
								<?php 
	                            the_posts_pagination(array(
								'mid_size' => 2,
								'prev_text' => '<i class="fa fa-arrow-left"></i>',
								'next_text' => '<i class="fa fa-arrow-right"></i>'
							));
							 ?>
							</div>
						</div>
					<?php endif; ?>

                </div>
				
				<?php if (is_active_sidebar('sidebar-1') && $blog_post_list_sidebar == '1' ) { ?>
					<div class="col-lg-4">
						<?php get_sidebar(); ?>
					</div>
				<?php } ?>
			</div>
        </div>
	</section>
<?php
get_footer();

