<?php

// Prevent Direct Access
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

// begin
function maxo_comment_layout_begin(){

	global $comment, $comment_depth;
?>
<div class="eny_profile" id="comment-<?php comment_ID() ?>">

	<div class="profile_photo">
		<?php echo get_avatar( $comment, 60 ) ?>
	</div>

	<div class="profile_text">

		<h6 class="darkcolor"><?php comment_author() ?></h6>

		<span class="comment_reply">
			<?php
			comment_reply_link(array(
				'reply_text' => '<i class="fa fa-reply"></i> '.esc_html__('Reply', 'maxo-fa'),
				'depth' => $comment_depth,
				'max_depth' => get_option('thread_comments_depth')
			));
			?>
		</span>

		<span class="comment_date"><?php comment_date('j F Y - H:i') ?></span>

		<?php comment_text() ?>

		<?php if(!$comment->comment_approved){ ?>
		<em><i class="fa fa-info-circle"></i> <?php esc_html_e('Your comment is awaiting moderation.', 'maxo-fa') ?></em>
		<?php } ?>
		
	</div>
<?php
}

// end
function maxo_comment_layout_end(){
	echo '</div>';
}

// comment field move
function maxo_move_comment_field_to_bottom($fields) {
	$comment_field = $fields['comment'];
	$cookies_field = $fields['cookies'];
	unset( $fields['comment'] );
	unset( $fields['cookies'] );
	$fields['comment'] = $comment_field;
	$fields['cookies'] = $cookies_field;
	return $fields;
}

add_filter('comment_form_fields', 'maxo_move_comment_field_to_bottom');
