<?php
/**
 * The main template file. Used for the blog page.
 *
 */

get_header(); ?>

<div class="header-widget-wrap">

	<div class="row">
		<div class="<?php if ( get_theme_mod( 'header_sidebar_blog' ) ) { echo "large-4 small-12"; } else { echo "large-12 small-12"; } ?> columns blog-title">				
			<header class="page-header">
			<?php 
				$blog_title = get_theme_mod( 'culinary_blog_title', 'Latest News' ); 
				if ( isset( $blog_title ) ) { 
					echo "<h2>";
					echo esc_attr( $blog_title );
					echo "</h2>";
				}

				$blog_subtitle = get_theme_mod( 'culinary_blog_subtitle', 'Change this title to anything in the Blog Page Customizer Section.' ); 
				if ( isset( $blog_subtitle ) ) { 
					echo "<h3>";
					echo esc_attr( $blog_subtitle );
					echo "</h3>";
				}
			?>
			</header> <!-- .page-header -->
		</div><!-- .large-4 / .large-12 -->

	</div><!-- .row -->

</div><!-- .header-widget-wrap -->

<div class="row">
	
	<?php $sidebar_layout = get_theme_mod( 'culinary_sidebar_layout', 'right-sidebar' ); ?>
	
	<?php if ( $sidebar_layout == "left-sidebar" ) { ?>

		<div class="large-3 columns small-12">
			<?php get_sidebar(); ?>
		</div><!-- .large-3 -->

	<?php } ?> 

	<div id="primary" class="content-area large-8 small-12 <?php if ( $sidebar_layout == "left-sidebar" ) { echo "large-offset-1"; } ?> columns">

		<main id="main" class="site-main" role="main">

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

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

				/*
				 * Include the Post-Format-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 Format name) and that will be used instead.
				 */
				get_template_part( 'template-parts/content', get_post_format() );

			endwhile;

			the_posts_navigation();

		else :

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

		endif; ?>

		</main><!-- #main -->
	</div><!-- #primary -->
<?php if ( $sidebar_layout == "right-sidebar" ) { ?>

		<div class="large-3 large-offset-1 columns small-12">
			<?php get_sidebar(); ?>
		</div><!-- .large-3 -->

	<?php } ?> 

</div><!-- .row -->
<?php
get_footer();
