<?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 Equable_Lite
 */


 $blogstyle = get_theme_mod( 'equable_lite_blog_style', 'blog3' );
 $equable_lite_blog_title = get_theme_mod( 'equable_lite_blog_title' );
 $equable_lite_blog_intro = get_theme_mod( 'equable_lite_blog_intro' );
 
get_header(); ?>

<div id="content" class="site-content <?php echo esc_attr( $blogstyle ); ?>">

<?php if ( $blogstyle == 'blog2')  : ?>	
	
<div class="container">

<div class="row">
	<div class="col-md-8 order-md-2">

	<?php if ( is_home() || is_front_page() ) : ?>
	
		<?php if( esc_attr(get_theme_mod( 'equable_lite_show_blog_heading', false ) ) ) : ?>
		<header class="page-header">			
				<h1 class="page-title"><?php echo esc_html( $equable_lite_blog_title ); ?></h1>			
			<?php if( esc_attr(get_theme_mod( 'equable_lite_show_blog_intro', false ) ) ) : ?>
				<p id="blog-description" class="lead"><?php echo esc_html( $equable_lite_blog_intro ); ?></p>
			<?php endif; ?>
		</header>
		<?php endif; ?>
		
	<?php else : ?>
	<header class="page-header">
		<h2 class="page-title sr-only"><?php esc_html_e( 'Posts', 'equable-lite' ); ?></h2>
	</header>
	<?php endif; ?>

		<main id="main" class="site-main">
			<?php
			if ( have_posts() ) :
				while ( have_posts() ) : the_post();
					get_template_part( 'template-parts/post/content', get_post_format() );
				endwhile;
					get_template_part( 'template-parts/navigation/navigation', 'blog' );
			else :
				get_template_part( 'template-parts/post/content', 'none' );
			endif;
			?>
		</main>
	</div>

	<div class="col-md-4 order-3 order-md-1">
		<?php get_template_part( 'template-parts/sidebars/sidebar', 'left' ); ?>       
	</div>	
	
</div></div>	
		
<?php elseif ( $blogstyle == 'blog3')  : ?>
<div class="container">

<div class="row">
	<div class="col-md-12">	

	<?php if ( is_home() || is_front_page() ) : ?>
	
		<?php if( esc_attr(get_theme_mod( 'equable_lite_show_blog_heading', false ) ) ) : ?>
		<header class="page-header">			
				<h1 class="page-title"><?php echo esc_html( $equable_lite_blog_title ); ?></h1>			
			<?php if( esc_attr(get_theme_mod( 'equable_lite_show_blog_intro', false ) ) ) : ?>
				<p id="blog-description" class="lead"><?php echo esc_html( $equable_lite_blog_intro ); ?></p>
			<?php endif; ?>
		</header>
		<?php endif; ?>
		
	<?php endif; ?>

		<main id="main" class="site-main">
			<?php
			if ( have_posts() ) :
				while ( have_posts() ) : the_post();
					get_template_part( 'template-parts/post/content', get_post_format() );
				endwhile;
					get_template_part( 'template-parts/navigation/navigation', 'blog' );
			else :
				get_template_part( 'template-parts/post/content', 'none' );
			endif;
			?>
		</main>
	
		</div>
	</div>
</div>		
			
<?php else : ?>

<div class="container">

<div class="row">
	<div class="col-md-8">

	<?php if ( is_home() || is_front_page() ) : ?>
	
		<?php if( esc_attr(get_theme_mod( 'equable_lite_show_blog_heading', false ) ) ) : ?>
		<header class="page-header">			
				<h1 class="page-title"><?php echo esc_html( $equable_lite_blog_title ); ?></h1>			
			<?php if( esc_attr(get_theme_mod( 'equable_lite_show_blog_intro', false ) ) ) : ?>
				<p id="blog-description" class="lead"><?php echo esc_html( $equable_lite_blog_intro ); ?></p>
			<?php endif; ?>
		</header>
		<?php endif; ?>
		
	<?php else : ?>
	<header class="page-header">
		<h2 class="page-title sr-only"><?php esc_html_e( 'Posts', 'equable-lite' ); ?></h2>
	</header>
	<?php endif; ?>

		<main id="main" class="site-main">
			<?php
			if ( have_posts() ) :
				while ( have_posts() ) : the_post();
					get_template_part( 'template-parts/post/content', get_post_format() );
				endwhile;
					get_template_part( 'template-parts/navigation/navigation', 'blog' );
			else :
				get_template_part( 'template-parts/post/content', 'none' );
			endif;
			?>
		</main>
	</div>

	<div class="col-md-4">
		<?php get_template_part( 'template-parts/sidebars/sidebar', 'right' ); ?>
	</div>
	
</div></div>

<?php endif; ?>	
		

<?php
get_footer();
