<?php get_header(); ?>

<main class="main-content">
    <div class="container">
        <div class="content-sidebar-layout">
            
            <!-- Main Content Area -->
            <div class="main-content-area">
                <?php while (have_posts()) : the_post(); ?>
                    <article class="page-content">
                        <?php if (get_theme_mod('pulsegrid_show_page_title', '1') == '1') : ?>
                        <header class="page-header">
                            <h1 class="page-title"><?php the_title(); ?></h1>
                        </header>
                        <?php endif; ?>
                        
                        <div class="page-content-body">
                            <?php the_content(); ?>
                        </div>
                        
                        <?php
                        // Check if comments are enabled for this page via metabox
                        $page_comments_enabled = get_post_meta(get_the_ID(), '_pulsegrid_enable_comments', true) == '1';
                        
                        if ($page_comments_enabled) :
                            comments_template();
                        endif;
                        ?>
                    </article>
                <?php endwhile; ?>
            </div>
            
            <!-- Sidebar -->
            <aside class="sidebar">
                <?php get_sidebar(); ?>
            </aside>
            
        </div>
    </div>
</main>

<?php get_footer(); ?>
