<?php
/**
 * The template for displaying single posts
 *
 * @package Blog_Over
 */

get_header();

$layout = get_theme_mod('blog_over_single_layout', 'single-right');
$has_sidebar = strpos($layout, 'full') === false;
$sidebar_position = strpos($layout, 'left') !== false ? 'left' : 'right';

// Content Width
$content_width = get_theme_mod('blog_over_single_content_width', 'default');
$content_width_class = 'content-width-' . $content_width;
?>

<main id="primary" class="blog-over-site-main blog-over-single-main">
    <div class="blog-over-page-header-container">
        <?php blog_over_page_header(); ?>
    </div>
    <?php if (blog_over_should_render_breadcrumb_container()): ?>
        <div class="blog-over-breadcrumb-container">
            <?php blog_over_breadcrumb(); ?>
        </div>
    <?php endif; ?>

    <div class="blog-over-container <?php echo esc_attr($content_width_class); ?>">
        <div
            class="blog-over-content-wrapper <?php echo esc_attr($has_sidebar ? 'has-sidebar sidebar-' . $sidebar_position : 'no-sidebar'); ?>">

            <?php if ($has_sidebar && $sidebar_position === 'left'): ?>
                <aside class="blog-over-sidebar">
                    <?php get_sidebar(); ?>
                </aside>
            <?php endif; ?>

            <div class="blog-over-main-content">
                <?php
                while (have_posts()):
                    the_post();
                    get_template_part('template-parts/content', 'single');
                endwhile;
                ?>
            </div>

            <?php if ($has_sidebar && $sidebar_position === 'right'): ?>
                <aside class="blog-over-sidebar">
                    <?php get_sidebar(); ?>
                </aside>
            <?php endif; ?>

        </div>
    </div>
</main>

<?php
get_footer();
