<?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 ismoderna
 */

/*
 * 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 id="comments" class="comment-section animate fadeInUp">

	<?php
	// You can start editing here -- including this comment!
	if ( have_comments() ) :
		?>
		<div class="section-titel2 mb-5"><h4 class="sction-cntfont-size">
			<?php echo esc_html(comments_number('No Comments', '1 Comment', '% Comments')); ?>
		</h4></div><!-- .comments-title -->

		<?php the_comments_navigation(); ?>

		<?php
		wp_list_comments(
			array(
				'style'      => 'div',
				'short_ping' => true,
				'callback'    => 'ismoderna_comment_list',
			)
		);
		?>
		<!-- .comment-list -->

		<?php
		the_comments_navigation();

		// If comments are closed and there are comments, let's leave a little note, shall we?
		if ( ! comments_open() ) : ?>
			<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'ismoderna' ); ?></p>
		<?php
		endif;
	endif; // Check for have_comments().
	?>
	<div class="space1"></div>
	<div class="comment_form">
		<?php 
		$args = array(
			'id_form'              => 'commentform',
			'id_submit'            => 'submit',
			'title_reply'          => esc_html__( 'Drop Your Comment', 'ismoderna' ),
			'title_reply_to'       => esc_html__( 'Leave A Reply To ', 'ismoderna' ) . '%s',
			'cancel_reply_link'    => esc_html__( 'Cancel Reply', 'ismoderna' ),
			'label_submit'         => esc_html__( 'Submit', 'ismoderna' ),
			'title_reply_before'   => '<h3>',
			'title_reply_after'    => '</h3>',
			'comment_notes_before' => '',
			'fields'               => apply_filters( 'comment_form_default_fields', 
				array(
					'author' =>
					'<div class="row"><div class="col-lg-6 col-md-12 form-group">'.
					'<input id="author" class="form-control" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) .
					'" size="30" placeholder="'.esc_attr__( 'Name', 'ismoderna' ).'"/></div>',

					'email' =>
					'<div class="col-lg-6 col-md-12 form-group">'.
					'<input id="email" class="form-control" name="email" type="email" value="' . esc_attr( $commenter['comment_author_email'] ) .
					'" size="30" placeholder="'.esc_attr__( 'Email', 'ismoderna' ).'"/></div></div>',
				)
			),
			'comment_field' =>  '
			<div class="row"><div class="col-lg-12 col-md-12"><textarea id="comment" class="form-control" name="comment" cols="45" rows="5" placeholder="'.esc_attr__( 'Your Comment', 'ismoderna' ).'" aria-required="true">' .
			'</textarea></div></div>',
			'submit_button' => '<input type="submit" class="btn main-btn" id="submit" value="Post Comment">',
		); 
		comment_form( $args ); ?>
	</div>
</div><!-- #comments -->