<?php
/**
 * The template for displaying comments
 *
 * @package Blog_Over
 */

if (post_password_required()) {
    return;
}
?>

<div id="comments" class="blog-over-comments-area">
    <?php if (have_comments()): ?>
        <h2 class="blog-over-comments-title">
            <?php
            $comment_count = get_comments_number();
            if ('1' === $comment_count) {
                printf(
                    esc_html__('One Response to &ldquo;%1$s&rdquo;', 'blog-over'),
                    '<span>' . wp_kses_post(get_the_title()) . '</span>'
                );
            } else {
                printf(
                    esc_html(_n('%1$s Response to &ldquo;%2$s&rdquo;', '%1$s Responses to &ldquo;%2$s&rdquo;', $comment_count, 'blog-over')),
                    number_format_i18n($comment_count),
                    '<span>' . wp_kses_post(get_the_title()) . '</span>'
                );
            }
            ?>
        </h2>

        <ol class="blog-over-comment-list">
            <?php
            wp_list_comments(array(
                'style' => 'ol',
                'short_ping' => true,
                'avatar_size' => 60,
                'callback' => 'blog_over_comment_callback',
            ));
            ?>
        </ol>

        <?php
        the_comments_navigation(array(
            'prev_text' => '<i class="fas fa-chevron-left"></i> ' . esc_html__('Older Comments', 'blog-over'),
            'next_text' => esc_html__('Newer Comments', 'blog-over') . ' <i class="fas fa-chevron-right"></i>',
        ));

        if (!comments_open()):
            ?>
            <p class="blog-over-no-comments"><?php esc_html_e('Comments are closed.', 'blog-over'); ?></p>
        <?php endif; ?>

    <?php endif; ?>

    <?php
    comment_form(array(
        'title_reply' => esc_html__('Leave a Reply', 'blog-over'),
        'title_reply_to' => esc_html__('Leave a Reply to %s', 'blog-over'),
        'cancel_reply_link' => esc_html__('Cancel Reply', 'blog-over'),
        'label_submit' => esc_html__('Post Comment', 'blog-over'),
        'comment_notes_before' => '<p class="blog-over-comment-notes">' . esc_html__('Your email address will not be published. Required fields are marked *', 'blog-over') . '</p>',
        'class_form' => 'blog-over-comment-form',
        'class_submit' => 'blog-over-submit-btn',
    ));
    ?>
</div>