<?php
/**
 * The main template file
 *
 * @package ChaletMontagne
 * @since 1.0.0
 */

get_header();
?>

<div class="site-container">
    <main id="primary" class="site-main" tabindex="-1">

        <?php
        // Breadcrumbs
        if (!is_front_page() && function_exists('chaletmontagne_breadcrumbs') && get_theme_mod('chaletmontagne_show_breadcrumbs', true)) :
            chaletmontagne_breadcrumbs();
        endif;
        ?>

        <?php
        if (have_posts()) :

            if (is_home() && !is_front_page()) :
                ?>
                <header class="page-header">
                    <h1 class="page-title"><?php single_post_title(); ?></h1>
                </header>
                <?php
            endif;

            // Start the Loop
            while (have_posts()) :
                the_post();

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

            endwhile;

            // Pagination
            the_posts_pagination(array(
                'prev_text' => esc_html__('Précédent', 'chalet-montagne'),
                'next_text' => esc_html__('Suivant', 'chalet-montagne'),
            ));

        else :

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

        endif;
        ?>

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

    <?php get_sidebar(); ?>
</div>

<?php
get_footer();
