<?php
/**
 * The template for displaying all single posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
 *
 * @package construc
 */
get_header();
/**
 * Blog Page Sidebar Control
 */
$getblogsidebar = get_theme_mod( 'blog_page_sidebar', 'right' );
$blogsidebar = 'col-md-5 col-lg-4 pl-lg-5 order-1';
$blogcontent = 'col-md-7 col-lg-8 order-0';
$sidebarshow = true;
if ($getblogsidebar === 'right') {
    $blogsidebar = 'col-md-5 pl-lg-5 col-lg-4 order-1';
    $blogcontent = 'col-md-7 col-lg-8 order-0';
    $sidebarshow = true;
}elseif ($getblogsidebar === 'left') {
    $blogsidebar = 'col-md-5 pl-lg-5 col-lg-4 order-0';
    $blogcontent = 'col-md-7 col-lg-8 order-1';
    $sidebarshow = true;
}elseif($getblogsidebar === 'no'){
    $blogsidebar = 'sidebar-hide';
    $blogcontent = 'col-md-12';
    $sidebarshow = false;
}else{
    $blogsidebar = 'col-md-5 col-lg-4 pl-lg-5 order-1';
    $blogcontent = 'col-md-7 col-lg-8 order-0';
}
?>
	<div id="primary" class="content-area">
		<main id="main" class="site-main">
			<div class="container">
				<div class="row">
					<div class="<?php echo esc_attr( $blogcontent );?> post-details-page">
						<?php
						while ( have_posts() ) :
							the_post();
							get_template_part( 'template-parts/content/content', 'single' );
							// the_post_navigation();
						endwhile; // End of the loop.
						?>
						<div class="d-flex single-post-navigation justify-content-between">
							<?php 
							if (!empty(get_previous_post())) :
							?>
							<div class="previous-post">
								<div class="postarrow">
									<?php
									$prevtext = __('Previous Post', 'construc');
									previous_post_link('%link', sprintf('<div class="previous-post"><i class="fa fa-long-arrow-left"></i> %s</div>', $prevtext));?>
								</div>
								<?php previous_post_link('%link');?>
							</div>
							<?php 
							endif;
							if (!empty(get_next_post())) :
							 ?>
							<div class="next-post">
								<div class="postarrow">
									<?php
									$nexttext = __('Next Post', 'construc');
									next_post_link('%link', sprintf('<div class="previous-post">%s <i class="fa fa-long-arrow-right"></i></div>', $nexttext));
									?>
								</div>
								<?php next_post_link('%link');?>
							</div>
							<?php endif; ?>
						</div>
						<?php
						// 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;
						?>
					</div>
					<?php if ($sidebarshow === true) :?>
                        <div class="<?php echo esc_attr( $blogsidebar );?>">
                            <?php get_sidebar(); ?>
                        </div>
                    <?php endif; ?>
				</div>
			</div>
		</main><!-- #main -->
	</div><!-- #primary -->
<?php
get_footer();
