<?php
/**
 * The template for displaying Comments.
 *
 * @package shrk
 */

/*
 * 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="comments-area">

	<?php // You can start editing here -- including this comment! ?>

	<?php if ( have_comments() ) : ?>
		<header class="page-header">
			<h2 class="comments-title">
				<?php
					printf( _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'ux-shop' ),
						number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' );
				?>
			</h2>
		</header>

		<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
		<nav id="comment-nav-above" class="comment-navigation">
			<h5 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'ux-shop' ); ?></h5>
			<ul class="pager">
				<li class="nav-previous"><?php previous_comments_link( '<i class="icon-ws-arrow-left"></i> ' . esc_html__( 'Older Comments', 'ux-shop' ) ); ?></li>
				<li class="nav-next"><?php next_comments_link( esc_html__( 'Newer Comments', 'ux-shop' ) . ' <i class="icon-ws-arrow-right"></i>' ); ?></li>
			</ul>
		</nav><!-- #comment-nav-above -->
		<?php endif; // check for comment navigation ?>

		<ol class="comment-list media-list">
			<?php
				wp_list_comments( array( 'callback' => 'shrk_comment', 'avatar_size' => 50 ) );
			?>
		</ol><!-- .comment-list -->

		<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
		<nav id="comment-nav-below" class="comment-navigation">
			<h1 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'ux-shop' ); ?></h1>
			<ul class="pager">
				<li class="nav-previous"><?php previous_comments_link( '<i class="icon-ws-arrow-left"></i> ' . esc_html__( 'Older Comments', 'ux-shop' ) ); ?></li>
				<li class="nav-next"><?php next_comments_link( esc_html__( 'Newer Comments', 'ux-shop' ) . ' <i class="icon-ws-arrow-right"></i>' ); ?></li>
			</ul>
		</nav><!-- #comment-nav-below -->
		<?php endif; // check for comment navigation ?>

	<?php endif; // have_comments() ?>

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

	<?php comment_form( $args = array(
		'id_form'             => 'commentform',
		'id_submit'           => 'commentsubmit',
		'title_reply'         => esc_html__( 'Leave a Reply', 'ux-shop' ),
		'title_reply_to'      => esc_html__( 'Leave a Reply to %s', 'ux-shop' ),
		'cancel_reply_link'   => esc_html__( 'Cancel Reply', 'ux-shop' ),
		'label_submit'        => esc_html__( 'Post Comment', 'ux-shop' ),
		'comment_field'       => '<p><textarea placeholder="' . esc_html__( 'Start typing...', 'ux-shop' ) . '" id="comment" class="form-control" name="comment" cols="45" rows="8" required></textarea></p>', 
		'comment_notes_after' => '<p class="form-allowed-tags">' . wp_kses( __( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:', 'ux-shop' ), shrk_kses_allowed() ) . '</p><div class="alert alert-info">' . allowed_tags() . '</div>' 
	)); 
	
	?>

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