<?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://codex.wordpress.org/Template_Hierarchy
 *
 * @package cleanlogic
 */

get_header(); ?>

<div id="primary" class="content-area front-page">
    <main id="main" class="site-main" role="main">

        <?php
        $show_on_front = get_option( 'show_on_front' );
        if ( 'posts' === $show_on_front ) :

            ?>
            <h2><?php echo esc_html__( 'Latest Articles', 'cleanlogic' ); ?></h2>

            <?php
            if ( have_posts() ) :

                while ( have_posts() ) :
                    the_post();

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

                endwhile;

                the_posts_pagination(
                    array(
                        'mid_size'           => 2,
                        'prev_text'          => esc_html_x( '« Previous', 'previous posts', 'cleanlogic' ),
                        'next_text'          => esc_html_x( 'Next »', 'next posts', 'cleanlogic' ),
                        'screen_reader_text' => esc_html__( 'Search navigation', 'cleanlogic' ),
                    )
                );

            else :

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

            endif;

        else :

            if ( have_posts() ) :
                while ( have_posts() ) :
                    the_post();

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

                endwhile;
            endif;

        endif;
        ?>

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

<?php
get_sidebar();
get_footer();