<?php
/**
 * Template part for displaying page content
 * 
 * Title is rendered in Page Header (blog_over_page_header function)
 * This template handles content and featured image only
 *
 * @package Blog_Over
 */

// Get page settings
global $blog_over_featured_used_as_header_bg;
$show_featured = get_theme_mod('blog_over_page_show_featured', true);
?>

<article id="post-<?php the_ID(); ?>" <?php post_class('blog-over-page-content'); ?>>

    <?php
    // Show featured image in content area ONLY if it hasn't been used as Page Header background
    if ($show_featured && has_post_thumbnail() && empty($blog_over_featured_used_as_header_bg)):
        ?>
        <div class="blog-over-page-thumbnail">
            <?php the_post_thumbnail('blog-over-featured'); ?>
        </div>
    <?php endif; ?>

    <div class="blog-over-page-body">
        <?php
        the_content();

        wp_link_pages(array(
            'before' => '<div class="blog-over-page-links">' . esc_html__('Pages:', 'blog-over'),
            'after' => '</div>',
        ));
        ?>
    </div>

    <?php if (get_edit_post_link()): ?>
        <footer class="blog-over-page-footer">
            <?php
            edit_post_link(
                sprintf(
                    wp_kses(
                        __('Edit <span class="screen-reader-text">%s</span>', 'blog-over'),
                        array(
                            'span' => array(
                                'class' => array(),
                            ),
                        )
                    ),
                    wp_kses_post(get_the_title())
                ),
                '<span class="blog-over-edit-link">',
                '</span>'
            );
            ?>
        </footer>
    <?php endif; ?>
</article>

<?php
// Comments section
if (get_theme_mod('blog_over_page_show_comments', true) && (comments_open() || get_comments_number())) {
    comments_template();
}
?>