<?php
/**
 * The template for displaying comments.
 *
 * The area of the page that contains both current comments
 * and the comment form.
 *
 * @package Maskitto Light
 */

/*
 * 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 comment_form(array(
		'comment_notes_after' => '',
		'comment_notes_before' => '',
		'comment_field' =>  '<p class="comment-form-comment"><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true" placeholder="' . _e( 'Write your comment here ...', 'maskitto-light' ) . '"></textarea></p>',
		'fields' => apply_filters( 'comment_form_default_fields', array(
			'author' =>
				'<p class="comment-form-author">
					<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" placeholder = "' . __( 'Name ', 'maskitto-light' ) . ( $req ? '*' : '' ) . '" size="30" />
				</p>',

			'email' =>
				'<p class="comment-form-email">
					<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) .'" placeholder = "' . __( 'Email ', 'maskitto-light' ) .( $req ? '*' : '' ) . '" size="30" />
				</p>',

			'url' =>
				'<p class="comment-form-url">
					<input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" placeholder = "' . __( 'Website ', 'maskitto-light' ) .( $req ? '*' : '' ) . '" size="30" />
				</p>'
			)
		),
	)); ?>

	<?php if ( have_comments() ) : ?>
		<h2 class="comments-title">
			<?php
				printf( _nx( '1 comment', '%1$s comments', get_comments_number(), 'comments title', 'maskitto-light' ),
					number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' );
			?>
		</h2>

		<ol class="comment-list">
			<?php

function mytheme_comment($comment, $args, $depth) {
	$GLOBALS['comment'] = $comment;
	extract($args, EXTR_SKIP);

	if ( 'div' == $args['style'] ) {
		$tag = 'div';
		$add_below = 'comment';
	} else {
		$tag = 'li';
		$add_below = 'div-comment';
	}
?>
	<<?php echo $tag ?> <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ) ?> id="comment-<?php comment_ID() ?>">
	<?php if ( 'div' != $args['style'] ) : ?>
	<div id="div-comment-<?php comment_ID() ?>" class="comment-body">
	<?php endif; ?>

	<div class="comment-column-left">
		<div class="comment-thumb"><?php if ( $args['avatar_size'] != 0 ) echo get_avatar( $comment, $args['avatar_size'] ); ?></div>
	</div>

	<div class="comment-column-right">
		<div class="row">
			<div class="col-md-6">
				<?php printf( __( '<span class="comment-author">%s</span>', 'maskitto-light' ), get_comment_author_link() ); ?>
				<?php if ( $comment->comment_approved == '0' ) : ?>
					<em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'maskitto-light' ); ?></em>
				<?php endif; ?>

				<span class="comment-date comment-meta commentmetadata grey"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ); ?>">
					<?php
						/* translators: 1: date, 2: time */
						printf( __('%1$s at %2$s', 'maskitto-light'), get_comment_date(),  get_comment_time() ); ?></a>
				</span>
			</div>
		</div>

		<div class="comment-content">
			<?php comment_text(); ?>
		</div>

		<div class="reply">
		<?php comment_reply_link( array_merge( $args, array( 'add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
		<span class="grey"><?php edit_comment_link( _e( 'Edit', 'maskitto-light' ), '  ', '' ); ?></span>
		</div>
	</div>


	<?php if ( 'div' != $args['style'] ) : ?>
	</div>
	<?php endif; ?>
<?php
}
				wp_list_comments( array(
					'style'      => 'ol',
					'short_ping' => true,
					'avatar_size' => 54,
					'max_depth' => '5',
					'callback' => 'mytheme_comment',

				) );
			?>
		</ol><!-- .comment-list -->

		<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
			<div class="comment-navigation grey-light"><?php paginate_comments_links(); ?></div>
		<?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 _e( 'Comments are closed.', 'maskitto-light' ); ?></p>
	<?php endif; ?>

</div>