<?php
/**
 * The template for displaying comments
 *
 * This is the template that displays the area of the page that contains both the current comments
 * and the comment form.
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package ShoBe
 */

/*
 * If the current post is protected by a password and
 * the visitor has not yet entered the password we will
 * return early without loading the comments.
 */
if ( post_password_required() ) {
	return;
}
?>
<div class="comments-area p-4 border" id="comments">
	<?php if ( have_comments() ) : ?>
		<h4 class="comments-title pb-3 border-bottom">
			<span><?php _e( 'Comments', 'shobe' ); ?></span>
			<?php printf( '(%s)', number_format_i18n( get_comments_number() ) ); ?>
		</h4>

		<?php the_comments_navigation(); ?>

		<div class="row">
            <div class="col">
			<?php
				wp_list_comments( array(
					'callback' => 'shobe_comment',
					
					'short_ping'  => true,
					'avatar_size' => 47,
				) );
			?>
			</div><!-- .comment-list -->
		</div>

		<?php the_comments_navigation(); ?>

	<?php endif; // Check for have_comments(). ?>

	<?php
		// If comments are closed and there are comments, let's leave a little note, shall we?
		if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
	?>
		<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'shobe' ); ?></p>
	<?php endif; ?>

	<?php
		comment_form( array(
			'title_reply_before' => '<h2 id="reply-title" class="comment-reply-title mt-4">',
			'title_reply_after'  => '</h2>',
		) );
	?>

</div><!-- .comments-area -->
