<?php
/**
 * The template for displaying all pages.
 *
 * @link https://codex.wordpress.org/Template_Hierarchy
 *
 * @package Leather House
 */

 if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
}

get_header();
?>

<section id="post-section" class="post-section av-py-default">
    <div class="container-full">
        <div class="av-columns-area">

            <?php
            if ( class_exists( 'WooCommerce' ) ) {
                if ( is_account_page() || is_cart() || is_checkout() ) {
                    $content_class = ! is_active_sidebar( 'leatherhouse-woocommerce-sidebar' ) ? '12' : '8';
                } else {
                    $content_class = ! is_active_sidebar( 'leatherhouse-sidebar-primary' ) ? '12' : '8';
                }
            } else {
                $content_class = ! is_active_sidebar( 'leatherhouse-sidebar-primary' ) ? '12' : '8';
            }
            ?>

            <div id="av-primary-content" class="av-column-<?php echo esc_attr( $content_class ); ?>">

                <?php if ( have_posts() ) : ?>
                    <?php while ( have_posts() ) : the_post(); ?>
                        <?php the_content(); ?>
                    <?php endwhile; ?>
                <?php endif; ?>

                <?php
                if ( comments_open() && post_type_supports( get_post_type(), 'comments' ) ) {
                    comments_template();
                }
                ?>
            </div>

            <?php
            if ( class_exists( 'WooCommerce' ) ) {
                if ( is_account_page() || is_cart() || is_checkout() ) {
                    get_sidebar( 'woocommerce' );
                } else {
                    get_sidebar();
                }
            } else {
                get_sidebar();
            }
            ?>

        </div>
    </div>
</section>

<?php get_footer(); ?>
