<?php
/**
 * The template for displaying archive pages
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package ismoderna
 */

get_header();
?>
<section class="ws-section-spacing">
    <div class="container">
        <div class="row">

            <?php if( get_theme_mod( 'ismoderna_Archive_Pages_Sidebar_Settings' ) == "Archive_Right_Sidebar" ) : ?>
                <div class="col-lg-8">
                    <?php
                    if ( have_posts() ) :
                        /* Start the Loop */
                        while ( have_posts() ) :
                            the_post(); ?>
                        
                            <?php
                            /*
                            * Include the Post-Type-specific template for the content.
                            * If you want to override this in a child theme, then include a file
                            * called content-___.php (where ___ is the Post Type name) and that will be used instead.
                            */
                            get_template_part( 'template-parts/content', get_post_type() );
                        endwhile;
                    else :
                        get_template_part( 'template-parts/content', 'none' );
                    endif;
                    ?>

                    <?php 
                    // Previous/next page navigation.
                    the_posts_pagination( array(
                    'prev_text'          => '<i class="fas fa-angle-double-left"></i>',
                    'next_text'          => '<i class="fas fa-angle-double-right"></i>',
                    ) ); 
                    ?>
                </div>
                <div class="col-lg-4">
                    <?php get_sidebar(); ?>
                </div>
            <?php endif; ?>

            <?php if( get_theme_mod( 'ismoderna_Archive_Pages_Sidebar_Settings' ) == "Archive_Left_Sidebar" ) : ?>
                <div class="col-lg-4">
                    <?php get_sidebar(); ?>
                </div>
                <div class="col-lg-8">
                    <?php
                    if ( have_posts() ) :
                        /* Start the Loop */
                        while ( have_posts() ) :
                            the_post(); ?>
                        
                            <?php
                            /*
                            * Include the Post-Type-specific template for the content.
                            * If you want to override this in a child theme, then include a file
                            * called content-___.php (where ___ is the Post Type name) and that will be used instead.
                            */
                            get_template_part( 'template-parts/content', get_post_type() );
                        endwhile;
                    else :
                        get_template_part( 'template-parts/content', 'none' );
                    endif;
                    ?>

                    <?php 
                    // Previous/next page navigation.
                    the_posts_pagination( array(
                    'prev_text'          => '<i class="fas fa-angle-double-left"></i>',
                    'next_text'          => '<i class="fas fa-angle-double-right"></i>',
                    ) ); 
                    ?>
                </div>
            <?php endif; ?>

            <?php if( get_theme_mod( 'ismoderna_Archive_Pages_Sidebar_Settings' ) == "Archive_No_Sidebar" ) : ?>
                <div class="col-lg-12">
                    <?php
                    if ( have_posts() ) :
                        /* Start the Loop */
                        while ( have_posts() ) :
                            the_post(); ?>
                        
                            <?php
                            /*
                            * Include the Post-Type-specific template for the content.
                            * If you want to override this in a child theme, then include a file
                            * called content-___.php (where ___ is the Post Type name) and that will be used instead.
                            */
                            get_template_part( 'template-parts/content', get_post_type() );
                        endwhile;
                    else :
                        get_template_part( 'template-parts/content', 'none' );
                    endif;
                    ?>

                    <?php 
                    // Previous/next page navigation.
                    the_posts_pagination( array(
                    'prev_text'          => '<i class="fas fa-angle-double-left"></i>',
                    'next_text'          => '<i class="fas fa-angle-double-right"></i>',
                    ) ); 
                    ?>
                </div>
            <?php endif; ?>

            <?php if( ! get_theme_mod( 'ismoderna_Archive_Pages_Sidebar_Settings' ) == "Archive_Right_Sidebar" and ! get_theme_mod( 'ismoderna_Archive_Pages_Sidebar_Settings' ) == "Archive_No_Sidebar" and ! get_theme_mod( 'ismoderna_Archive_Pages_Sidebar_Settings' ) == "Archive_Left_Sidebar" ) : ?>
                <div class="col-lg-8">
                    <?php
                    if ( have_posts() ) :
                        /* Start the Loop */
                        while ( have_posts() ) :
                            the_post(); ?>
                        
                            <?php
                            /*
                            * Include the Post-Type-specific template for the content.
                            * If you want to override this in a child theme, then include a file
                            * called content-___.php (where ___ is the Post Type name) and that will be used instead.
                            */
                            get_template_part( 'template-parts/content', get_post_type() );
                        endwhile;
                    else :
                        get_template_part( 'template-parts/content', 'none' );
                    endif;
                    ?>

                    <?php 
                    // Previous/next page navigation.
                    the_posts_pagination( array(
                    'prev_text'          => '<i class="fas fa-angle-double-left"></i>',
                    'next_text'          => '<i class="fas fa-angle-double-right"></i>',
                    ) ); 
                    ?>
                </div>
                <div class="col-lg-4">
                    <?php get_sidebar(); ?>
                </div>
            <?php endif; ?>

        </div>
    </div>
</section>
<?php get_footer(); ?>