<?php 
/**
 * Trending news comments
**/ 
?>
<?php
$commenter = wp_get_current_commenter ();
$req = get_option ( 'require_name_email' );
$aria_req = ($req ? " aria-required='true'" : '');

$tn_comments_name = get_option('tn_comments_name');
$tn_comments_email = get_option('tn_comments_email');
$tn_comments_website = get_option('tn_comments_website');
$fields = array (
		'author' => '<p class="comment-author">' . '<label for="author">' . $tn_comments_name . '</label> ' . ($req ? '<span class="required">*</span>' : '') . '<input id="author" name="author" type="text" value="' . esc_attr ( $commenter ['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
		'email' => '<p class="comment-email"><label for="email">' . 'Email' . '</label> ' . ($req ? '<span class="required">*</span>' : '') . '<input id="email" name="email" type="text" value="' . esc_attr ( $commenter ['comment_author_email'] ) . '"  size="30"' . $aria_req . ' /></p>',
		'url'    => '<p class="comment-url"><label for="url">' . 'Website'  . '</label>' .
		'<input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '"/></p>'
);


$tn_comments_post_comment = get_option('tn_comments_post_comment');
$tn_comments_post_reply = get_option('tn_comments_post_reply');
$tn_comments_post_reply_to = get_option('tn_comments_post_reply_to');
$tn_comments_cancel_reply = get_option('tn_comments_cancel_reply');




$comments_args = array (
		'comment_field' => '<p class="comment-form-comment"><textarea id="comment" name="comment" height="310" width="630" aria-required="true"></textarea></p>',
		'comment_notes_after' => '',
		'comment_notes_before' => '',
		'title_reply' =>'Leave a Reply',
		'label_submit' => $tn_comments_post_comment,
		'id_submit'            => 'submit',
		'title_reply'          => $tn_comments_post_reply,
    	'title_reply_to'       => $tn_comments_post_reply_to,
    	'cancel_reply_link'    => $tn_comments_cancel_reply,
		'fields' => $fields 
);




function tn_discussion($comment, $args, $depth) {
	$GLOBALS ['comment'] = $comment;
	
	?>

<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
	<div class="gravatar-comment">
		<?php echo get_avatar( get_comment_author_email(), '60' ); ?>
	</div><!--gravatar-comment-->
	<div class="comment-author-name">
		<?php comment_author(); ?>
	</div><!--comment-author-name-->
	<div class="comment-date-time">
		<?php comment_date('j F Y'); ?>
		at
		<?php comment_time(); ?>
		-
		<?php comment_reply_link( array_merge( $args, array( 'reply_text' =>  'Reply', 'depth' => $depth) ) ); ?>
	</div><!--comment-date-time-->
	<article id="comment-<?php comment_ID(); ?>" class="comment">
		<div class="comment-content">
			<?php comment_text(); ?>
		</div>
	</article><!--comment-->
</li>
<?php } ?>
<div class="comment-count">
	
	<?php 
	$tn_comments_no_comment = get_option('tn_comments_no_comment');
	$tn_comments_one_comment = get_option('tn_comments_one_comment');
	$tn_comments_number_comments = get_option('tn_comments_number_comments');

	comments_number( $tn_comments_no_comment, $tn_comments_one_comment, '% '.$tn_comments_number_comments ); 
	
	?>
</div><!--comment-count-->
<?php comment_form( $comments_args ); ?>
<div class="discussion">
	<?php wp_list_comments( array (
		'callback' => 'tn_discussion'
		));
	?>
	<div class="comment-pagination">
		<?php paginate_comments_links(); ?>
	</div><!--comment-pagination-->
</div><!--discussion-->
