<?php
/**
 * The template for displaying all single posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
 *
 * @package Edify
 */

get_header();

$show_post_header = get_theme_mod('show_post_header',true); 

if($show_post_header){
	get_template_part( 'template-parts/banner/banner-post');
	
}



$show_post_nav = get_theme_mod('show_post_nav',true); 

$tsp_blog_sidebar = get_theme_mod('blog_sidebar','right'); 

$blog_column = is_active_sidebar( 'blog-sidebar' ) ? 8 : 12;
$blog_column = ( $tsp_blog_sidebar !== 'no' && is_active_sidebar( 'blog-sidebar' ) ) ? 8 : 12;
?>

<div class="page-wrapper">
	<main id="main" class="site-main">
		<div class="container">
			<div class="row justify-content-center">
			   <?php if ( is_active_sidebar( 'blog-sidebar' ) && ($tsp_blog_sidebar == 'left')): ?>
					<div class="col-lg-4 col-xl-4">
						<div class="blog-sidebar mb-5 mt-lg-0">
							<?php get_sidebar();?>
						</div>
					</div>
				<?php endif; ?>
				
				
				<div class="col-xl-<?php print esc_attr( $blog_column );?>  col-lg-<?php print esc_attr( $blog_column );?> col-md-12">
				
					<?php
					while ( have_posts() ) :
						the_post();

						get_template_part( 'template-parts/content', 'single' );
						
						get_template_part( 'template-parts/single/single-post-author' );
						
						if($show_post_nav) {
							edify_post_navigation();
						}


						// If comments are open or we have at least one comment, load up the comment template.
						if ( comments_open() || get_comments_number() ) :
							comments_template();
						endif;

					endwhile; // End of the loop.
				?>	
				
				

				</div><!-- End Col -->
				
				
			<?php if ( is_active_sidebar( 'blog-sidebar' ) && ($tsp_blog_sidebar == 'right')): ?>
					<div class="col-lg-4 col-xl-4">
						<div class="blog-sidebar mt-5 mt-lg-0">
							<?php echo get_sidebar();?>
						</div>
					</div>
				<?php endif;?>
			</div>
		</div>
	</main>
</div>


<?php
get_footer();
