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



<?php if ( ! comments_open() ) : ?>
			<h3 class="comments-heading"><?php esc_html_e( 'Comments are closed.', 'mohi' ); ?></h3>
<?php endif; ?>



 <section id="comments" class="comments-area mt-5 pt-5">

	<?php
	$commenter = wp_get_current_commenter();

	$args = array(

		'class_form' => 'comment-form d-flex align-items-end flex-column',
		'id_form'    => 'commentform',

		'title_reply' => '',
		'title_reply_before' => '',
		'title_reply_after'  => '',

		'comment_field' =>
		'<div class="mb-3 col-12">
			<textarea id="comment" name="comment" class="form-control" rows="6"
			placeholder="' . esc_attr__( 'Join the discussion...', 'mohi' ) . '" required></textarea>
		</div>',

		'fields' => array(

			'author' =>
			'<div class="mb-3 col-12">
				<input id="author" name="author" type="text"
				class="form-control"
				placeholder="' . esc_attr__( 'Your Name', 'mohi' ) . '"
				value="' . esc_attr( $commenter['comment_author'] ) . '"
				required>
			</div>',

			'email' =>
			'<div class="mb-3 col-12">
				<input id="email" name="email" type="email"
				class="form-control"
				placeholder="' . esc_attr__( 'Your Email', 'mohi' ) . '"
				value="' . esc_attr( $commenter['comment_author_email'] ) . '"
				required>
			</div>',
		),

		'submit_button' =>
		'<div class="d-grid d-flex align-items-end flex-column col-2 my-3 gap-2">
			<input name="submit" type="submit" id="submit"
			class="btn cmt-btn" value="' . esc_attr__( 'Post Comment', 'mohi' ) . '">
		</div>',
	);

	comment_form( $args );
	?>

	<?php if ( have_comments() ) : ?>
		<h4 class="mt-4">
			<?php
			printf(
				esc_html( _n( '%s Comment', '%s Comments', get_comments_number(), 'mohi' ) ),
				number_format_i18n( get_comments_number() )
				);
			?>
		</h4>

		<ul class="comments-list list-unstyled mt-3">
			<?php
			wp_list_comments( array(
				'style'       => 'ul',
				'avatar_size' => 50,
			) );
			?>
		</ul>
	<?php endif; ?>

</section>