<?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://codex.wordpress.org/Template_Hierarchy
 *
 * @package glides
 */

get_header(); 
$glides_blog_pg_layout 			= get_theme_mod('blog_page_layout', 'glides_rsb'); 
$pg_blog_ttl 		= get_theme_mod('pg_blog_ttl','What People Writes');
$pg_blog_subttl 	= get_theme_mod('pg_blog_subttl','Outstanding Blog');
$col_class = ($glides_blog_pg_layout == 'glides_fullwidth')?'col-lg-10 mx-auto':'col-lg-8';
glides_breadcrumbs_style();
?>
<!-- blog section -->
    <section class="blog-section">
        <div class="container">
			<?php if(!empty($pg_blog_ttl)  || !empty($pg_blog_subttl)): ?>
				<div class="section-title">
					<?php if(!empty($pg_blog_subttl)): ?>
						<span>
							<?php echo esc_html($pg_blog_subttl); ?>
						</span>
					<?php endif; ?>
					
					<?php if(!empty($pg_blog_ttl)): ?>
						<h2>
							<?php echo wp_kses_post($pg_blog_ttl); ?>
						</h2>
					<?php endif; ?>
				</div>
			<?php endif; ?>
            
            <div class="row">
				<?php if($glides_blog_pg_layout == 'glides_lsb'): get_sidebar(); endif; ?>	
				<div class="<?php echo esc_attr($col_class); ?>">
                    <div class="row">
						<?php if( have_posts() ): ?>
							<?php while( have_posts() ) : the_post(); 
						?>
						<div class="col-lg-6">
							<?php get_template_part('parts/default/post','page'); ?>
						</div>
						<?php endwhile; ?>	
						<!-- Pagination -->
						<?php								
								// Previous/next page navigation.
								the_posts_pagination( array(
								'prev_text'          => ' <i class="fa fa-chevron-left"></i>',
								'next_text'          => '<i class="fa fa-chevron-right"></i>',
								) ); ?>
						<!-- Pagination -->	
						
						<?php else: ?>
							<?php get_template_part('parts/default/post','none'); ?>
						<?php endif; ?>
                    </div>
                </div>
				<?php if($glides_blog_pg_layout == 'glides_rsb'): get_sidebar(); endif; ?>
            </div>
        </div>
    </section>
    <!-- end -->
<?php get_footer(); ?>
