<?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 IS-Medify
 * 
 * @since 1.0.0
 * 
*/

/*
 * 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;
}
?>
<?php if ( have_comments() ) : ?>
<div class="row comment">
		<h3>
			<i class="fa fa-comments"></i>
			<?php echo esc_html_e( comments_number(__('No Comments','is-medify'), __('1 Comment','is-medify'), '% Comments') ); ?>
		</h3>
		<?php wp_list_comments( array( 'callback' => 'is_medify_comment_list_display' ) ); ?>		
		<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
		<nav id="comment-nav-below">
			<h1 class="assistive-text"><?php esc_html_e( 'Comment navigation', 'is-medify' ); ?></h1>
			<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'is-medify' ) ); ?></div>
			<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'is-medify' ) ); ?></div>
		</nav>
	<?php endif;  ?>
	</div>		
<?php endif; ?>

<div id="comments" class="comments-area">

	<?php if ( comments_open() ) : ?>
		<div class="row feedback">
			<?php $consent = '' ;
				$is_medify_fields = array(
				'author' => '<div class="form-group col-md-4"><label  for="name">NAME:</label><input type="text" class="form-control" id="name" name="author" placeholder="Full Name"></div>',
				'email' => '<div class="form-group col-md-4"><label for="email">EMAIL:</label><input type="email" class="form-control" id="email" name="email" placeholder="Your Email Address"></div>',
				'website' => '<div class="form-group col-md-4"><label  for="web">WEBSITE:</label><input type="text" class="form-control" id="web" placeholder="Website"></div>',
				'cookies' => '<div class="form-group animate col-sm-12 " data-anim-type="fadeInUpLarge" data-anim-delay="400">
	                       <p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"' . $consent . ' />' .
	                           '<label for="wp-comment-cookies-consent">' . __( 'Save my name, email, and website in this browser for the next time I comment.','is-medify' ) . '</label>
	                       </p>
	                     </div>',
			);
			function is_medify_my_fields($is_medify_fields) { 
				return $is_medify_fields;
			}
			add_filter('wl_comment_form_default_fields','is_medify_my_fields');
				$is_medify_defaults = array(
					'fields'=> apply_filters( 'wl_comment_form_default_fields', $is_medify_fields ),
					'comment_field'=> '<div class="form-group col-md-12"><label  for="message">COMMENT:</label><textarea class="form-control" rows="5" id="comment" name="comment" placeholder="Message"></textarea></div>',		
					'logged_in_as' => '<p class="logged-in-as">'. __( "Logged in as ",'is-medify' ).'<a href="'.admin_url( 'profile.php' ).'">'.$user_identity.'</a>'.'<a href="'. wp_logout_url( get_permalink() ).'" title="Log out of this account">'.__(" Log out?",'is-medify').'</a>' . '</p>', /* translators: %s: Reply to name */
					'title_reply_to' => __( 'Leave a Reply to %s','is-medify'),
					'class_submit' => 'btn',
					'label_submit'=>__( 'Post Comment','is-medify'),
					'comment_notes_before'=> '',
					'comment_notes_after'=>'',
					'title_reply'=> '<h2>'.__('Leave a Reply','is-medify').'</h2>',
					'role_form'=> 'form',
				);
			comment_form( $is_medify_defaults ); ?>		
		</div>
	<?php endif; // If registration required and not logged in ?>

</div><!-- #comments -->




