<?php

/**
 * The template for displaying all pages
 *
 * This is the template that displays all pages by default.
 * Please note that this is the WordPress construct of pages
 * and that other 'pages' on your WordPress site may use a
 * different template.
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package hostiko
 */

$akd_theme_admin_page = get_option( 'akd-framework-admin-page' );

if(isset($akd_theme_admin_page['opt-image-select-shop-layout']) && $akd_theme_admin_page['opt-image-select-shop-layout'] == 'right-sidebar'){

$blog_column = is_active_sidebar( 'right-sidebar' ) ? 8 : 12 ;
$blog_column_shop = is_active_sidebar( 'right-sidebar-shop' ) ? 8 : 12 ;

get_header();

?>
<div id="primary" class="content-area hostiko-page-containerr">
    <main id="main" class="site-main">
        <div class="container">
            <div class="row justify-content-center">
                <?php
				
					if(is_active_sidebar( 'right-sidebar' ) && function_exists ('is_shop') && !is_shop() && !is_cart() && !is_checkout()){
						?>
                <div class="col-lg-<?php print esc_attr($blog_column); ?>">
                    <?php
					}else if(is_active_sidebar( 'right-sidebar-shop' ) && function_exists ('is_shop') && (is_product() || is_shop())){
						?>
                    <div class="col-lg-<?php print esc_attr($blog_column_shop); ?>">
                        <?php
					}else if(function_exists('is_cart') && is_cart()){
						?>
                        <div class="col-lg-12">
                            <?php
					}else if(function_exists('is_checkout') && is_checkout()){
						?>
                        <div class="col-lg-12">
                            <?php
					}
						while ( have_posts() ) :
							the_post();

							get_template_part( 'template-parts/content', 'page' );

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

						endwhile; // End of the loop.
					?>
                        </div>
                        <?php if ( is_active_sidebar( 'right-sidebar' ) && function_exists('is_shop') && !is_shop() && !is_cart() && !is_checkout()) {?>
                        <div class="col-lg-4 sidebar-blog right-side">
                            <?php get_sidebar(); ?>
                        </div>
                        <?php }
						else if ( is_active_sidebar( 'right-sidebar-shop' ) && function_exists ('is_product') &&  (is_product() || is_shop()) ) { 
							
							?>
                        <div class="col-lg-4 sidebar-blog right-side">
                            <?php get_sidebar('shop'); ?>
                        </div>
                        <?php } ?>
                    </div>
                </div>
    </main><!-- #main -->
</div><!-- #primary -->

<?php get_footer();
}
else if(isset($akd_theme_admin_page['opt-image-select-shop-layout']) && $akd_theme_admin_page['opt-image-select-shop-layout'] == 'left-sidebar'){

    $blog_column = is_active_sidebar( 'right-sidebar' ) ? 8 : 12 ;
    $blog_column_shop = is_active_sidebar( 'right-sidebar-shop' ) ? 8 : 12 ;
    
    get_header();
    
    ?>
<div id="primary" class="content-area hostiko-page-containerr">
    <main id="main" class="site-main">
        <div class="container">
            <div class="row justify-content-center">
                <?php if ( is_active_sidebar( 'right-sidebar' ) && function_exists('is_shop') && !is_shop() && !is_cart() && !is_checkout()) {?>
                <div class="col-lg-4 sidebar-blog right-side">
                    <?php get_sidebar(); ?>
                </div>
                <?php }
                            else if ( is_active_sidebar( 'right-sidebar-shop' ) && function_exists ('is_product') &&  (is_product() || is_shop()) ) { 
                                
                                ?>
                <div class="col-lg-4 sidebar-blog right-side">
                    <?php get_sidebar('shop'); ?>
                </div>
                <?php } ?>
                <?php
                    
                        if(is_active_sidebar( 'right-sidebar' ) && function_exists ('is_shop') && !is_shop() && !is_cart() && !is_checkout()){
                            ?>
                <div class="col-lg-<?php print esc_attr($blog_column); ?>">
                    <?php
                        }else if(is_active_sidebar( 'right-sidebar-shop' ) && function_exists ('is_shop') && (is_product() || is_shop())){
                            ?>
                    <div class="col-lg-<?php print esc_attr($blog_column_shop); ?>">
                        <?php
                        }else if(function_exists('is_cart') && is_cart()){
                            ?>
                        <div class="col-lg-12">
                            <?php
                        }else if(function_exists('is_checkout') && is_checkout()){
                            ?>
                        <div class="col-lg-12">
                            <?php
                        }
                            while ( have_posts() ) :
                                the_post();
    
                                get_template_part( 'template-parts/content', 'page' );
    
                                //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;
    
                            endwhile; // End of the loop.
                        ?>
                        </div>

                    </div>
                </div>
    </main><!-- #main -->
</div><!-- #primary -->

<?php get_footer();
}
else if(isset($akd_theme_admin_page['opt-image-select-shop-layout']) && $akd_theme_admin_page['opt-image-select-shop-layout'] == 'full-width'){

    $blog_column = 12 ;
    $blog_column_shop = 12 ;
    
    get_header();
    
    ?>
<div id="primary" class="content-area hostiko-page-containerr">
    <main id="main" class="site-main">
        <div class="container">
            <div class="row justify-content-center">
                <?php
                    
                        if(is_active_sidebar( 'right-sidebar' ) && function_exists ('is_shop') && !is_shop() && !is_cart() && !is_checkout()){
                            ?>
                <div class="col-lg-<?php print esc_attr($blog_column); ?>">
                    <?php
                        }else if(is_active_sidebar( 'right-sidebar-shop' ) && function_exists ('is_shop') && (is_product() || is_shop())){
                            ?>
                    <div class="col-lg-<?php print esc_attr($blog_column_shop); ?>">
                        <?php
                        }else if(function_exists('is_cart') && is_cart()){
                            ?>
                        <div class="col-lg-12">
                            <?php
                        }else if(is_checkout()){
                            ?>
                        <div class="col-lg-12">
                            <?php
                        }
                            while ( have_posts() ) :
                                the_post();
    
                                get_template_part( 'template-parts/content', 'page' );
    
                                //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;
    
                            endwhile; // End of the loop.
                        ?>
                        </div>

                    </div>
                </div>
    </main><!-- #main -->
</div><!-- #primary -->

<?php get_footer();
}
else{
    $blog_column = is_active_sidebar( 'right-sidebar' ) ? 8 : 12 ;
$blog_column_shop = is_active_sidebar( 'right-sidebar-shop' ) ? 8 : 12 ;

get_header();

?>
<div id="primary" class="content-area hostiko-page-containerr">
    <main id="main" class="site-main">
        <div class="container">
            <div class="row justify-content-center">
                <?php
				
					if(is_active_sidebar( 'right-sidebar' ) && function_exists ('is_shop') && !is_shop() && !is_cart() && !is_checkout()){
						?>
                <div class="col-lg-<?php print esc_attr($blog_column); ?>">
                    <?php
					}else if(is_active_sidebar( 'right-sidebar-shop' ) && function_exists ('is_shop') && (is_product() || is_shop())){
						?>
                    <div class="col-lg-<?php print esc_attr($blog_column_shop); ?>">
                        <?php
					}else if(function_exists('is_cart') && is_cart()){
						?>
                        <div class="col-lg-12">
                            <?php
					}else if(is_checkout()){
						?>
                        <div class="col-lg-12">
                            <?php
					}
						while ( have_posts() ) :
							the_post();

							get_template_part( 'template-parts/content', 'page' );

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

						endwhile; // End of the loop.
					?>
                        </div>
                        <?php if ( is_active_sidebar( 'right-sidebar' ) && function_exists('is_shop') && !is_shop() && !is_cart() && !is_checkout()) {?>
                        <div class="col-lg-4 sidebar-blog right-side">
                            <?php get_sidebar(); ?>
                        </div>
                        <?php }
						else if ( is_active_sidebar( 'right-sidebar-shop' ) && function_exists ('is_product') &&  (is_product() || is_shop()) ) { 
							
							?>
                        <div class="col-lg-4 sidebar-blog right-side">
                            <?php get_sidebar('shop'); ?>
                        </div>
                        <?php } ?>
                    </div>
                </div>
    </main><!-- #main -->
</div><!-- #primary -->

<?php get_footer();
}