<?php
/**
 * Template part for displaying page content
 *
 * @package ChaletMontagne
 * @since 1.0.0
 */
?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

    <?php if (!chaletmontagne_is_location_page()) : ?>
        <header class="entry-header">
            <?php the_title('<h1 class="entry-title">', '</h1>'); ?>
        </header><!-- .entry-header -->
    <?php endif; ?>

    <?php if (has_post_thumbnail() && !chaletmontagne_is_location_page()) : ?>
        <figure class="post-thumbnail featured-image-container">
            <div class="featured-image-frame">
                <?php the_post_thumbnail('large', array(
                    'class' => 'featured-image',
                    'loading' => 'eager'
                )); ?>
                <div class="featured-image-overlay"></div>
            </div>
            <?php
            $caption = get_the_post_thumbnail_caption();
            if ($caption) : ?>
                <figcaption class="featured-image-caption"><?php echo esc_html($caption); ?></figcaption>
            <?php endif; ?>
        </figure>
    <?php endif; ?>

    <div class="entry-content">
        <?php
        the_content();

        wp_link_pages(array(
            'before' => '<div class="page-links">' . esc_html__('Pages:', 'chalet-montagne'),
            'after'  => '</div>',
        ));
        ?>
    </div><!-- .entry-content -->

    <?php if (get_edit_post_link()) : ?>
        <footer class="entry-footer">
            <?php
            edit_post_link(
                sprintf(
                    wp_kses(
                        /* translators: %s: Name of current post. Only visible to screen readers */
                        __('Modifier <span class="screen-reader-text">%s</span>', 'chalet-montagne'),
                        array(
                            'span' => array(
                                'class' => array(),
                            ),
                        )
                    ),
                    wp_kses_post(get_the_title())
                ),
                '<span class="edit-link">',
                '</span>'
            );
            ?>
        </footer><!-- .entry-footer -->
    <?php endif; ?>

</article><!-- #post-<?php the_ID(); ?> -->
