<?php
global $options, $sidebar, $post;

$active_sidebar = is_active_sidebar( 'irk-sidebar' ) && get_post_meta( $post->ID, 'irk_active_sidebar', true );
?>
<?php get_header(); ?>
<?php get_template_part( 'partials/main-header' ); ?>
    <main id="main">
        <div class="container">
            <div class="row">
				<?php $active_sidebar ? get_sidebar() : null; ?>
                <div class="post-container col-12 <?php echo $active_sidebar ? 'col-lg-9' : ''; ?>">
					<?php if ( have_posts() ): ?>
						<?php while ( have_posts() ): ?>
							<?php the_post(); ?>
                            <article <?php post_class( 'post-inner' ); ?>>
                                <header class="post-header">
                                    <h1 class="post-title"><?php the_title(); ?></h1>
                                </header>
                                <div class="post-body">
									<?php the_content(); ?>
                                </div>
                            </article>
                            <?php if ( comments_open( get_the_ID() ) ): ?>
                                <div class="comments-template">
                                    <header class="template-header">
                                        <strong><?php echo esc_html( $labels->get_label( 'post-comments' ) ); ?></strong>
                                    </header>
                                    <?php comments_template( '', true ); ?>
                                </div>
                            <?php endif; ?>
						<?php endwhile; ?>
					<?php endif; ?>
                </div>
            </div>
        </div>
    </main>
<?php
get_template_part( 'partials/main-footer' );
get_footer();