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

/*
 * 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"><h2 class="sction-cntfont-size"><span>
			<?php echo esc_html(comments_number('No Comments', '1 Comment', '% Comments')); ?>
		</span></h2></div><!-- .comments-title -->

		<?php the_comments_navigation(); ?>

		<?php
		wp_list_comments(
			array(
				'style'      => 'div',
				'short_ping' => true,
				'callback'    => 'wheelify_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.', 'wheelify' ); ?></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', 'wheelify' ),
			'title_reply_to'       => esc_html__( 'Leave A Reply To ', 'wheelify' ) . '%s',
			'cancel_reply_link'    => esc_html__( 'Cancel Reply', 'wheelify' ),
			'label_submit'         => esc_html__( 'Submit', 'wheelify' ),
			'title_reply_before'   => '<h2>',
			'title_reply_after'    => '</h2>',
			'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"><div class="input-group">'.
					'<input id="author" class="form-control" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) .
					'" size="30" placeholder="'.esc_attr__( 'Name', 'wheelify' ).'"/><span class="form-icon fas fa-pencil-alt"></span></div></div>',

					'email' =>
					'<div class="col-lg-6 col-md-12 form-group"><div class="input-group">'.
					'<input id="email" class="form-control" name="email" type="email" value="' . esc_attr( $commenter['comment_author_email'] ) .
					'" size="30" placeholder="'.esc_attr__( 'Email', 'wheelify' ).'"/><span class="form-icon fas fa-envelope"></span></div></div></div>',
				)
			),
			'comment_field' =>  '
			<div class="col-lg-12 col-md-12 form-group"><div class="input-group mb-2 mb-sm-0"><textarea id="comment" class="form-control" name="comment" cols="45" rows="5" placeholder="'.esc_attr__( 'Your Comment', 'wheelify' ).'" aria-required="true">' .
			'</textarea></div></div>',
			'submit_button' => '<div class="col-lg-12 about-text text-right"><input type="submit" class="btn main-btn" id="submit" value="send"></div>',
		); 
		comment_form( $args ); ?>
	</div>
</div><!-- #comments -->