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

get_header();
?>
<div class="ct-main-body">
    <?php if ( has_post_thumbnail() ): ?>
        <div class="container featured-display">
            <div class="row">
                <div class="twelve columns">
                    <?php
                        if ( have_posts() ) {

                            // Load posts loop.
                            while ( have_posts() ) {
                                the_post();

                    ?>
                                    <div class="thumbnail-area">
                                        <?php the_post_thumbnail( 'prime-business-1200-16x9' ) ?>

                                        <div class="post-date">
                                            <span><?php echo esc_html( get_the_date() ); ?></span>
                                        </div><!-- /.post-date -->
                                    </div><!-- /.image-container -->
                    <?php
                            }
                        }
                    ?>
                </div><!-- /.twelve columns -->
            </div><!-- /.row -->
        </div><!-- /.container -->
        <?php endif; ?>

        <?php
            $prime_business_cols = 'nine';
            if ( !is_active_sidebar( 'prime-business-main-sidebar' ) ) {
                $prime_business_cols = 'twelve';
            }
        ?>

        <div class="container post-body">
            <div class="row">
                <div class="<?php echo esc_attr( $prime_business_cols ); ?> columns">
                    <?php
                        if ( have_posts() ) {

                            // Load posts loop.
                            while ( have_posts() ) {
                                the_post();
                                get_template_part( 'template-parts/content/content', 'single' );

                                // 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;
                            }

                        } else {

                            // If no content, include the "No posts found" template.
                            get_template_part( 'template-parts/content/content', 'none' );

                        }
                    ?>
                </div><!-- /.nine columns -->
                <?php get_sidebar(); ?>
            </div><!-- /.row -->
        </div><!-- /.container -->
    </div>
<?php
get_footer();
