<?php

function fanspaysite_enqueue_comments_reply() {
    if (get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
}
add_action('comment_form_before', 'fanspaysite_enqueue_comments_reply');

function fanspaysite_comment_callback($comment, $args, $depth) {
    $tag = ('div' === $args['style']) ? 'div' : 'li';
    ?>
    <<?php echo $tag; ?> class="comment" id="comment-<?php comment_ID(); ?>">
        <div class="avatar">
            <?php if (0 != $args['avatar_size']) echo get_avatar($comment, $args['avatar_size']); ?>
        </div>
        <div class="content">
            <div class="author">
                <?php echo get_comment_author_link($comment); ?>
            </div>
            <div class="metadata">
                <div class="date">
                    <?php printf(esc_html__('%1$s at %2$s', 'fanspaysite'), get_comment_date('', $comment), get_comment_time()); ?>
                </div>
            </div>
            <div class="text">
                <?php comment_text(); ?>
            </div>
            <div class="actions">
                <?php
                comment_reply_link(array_merge($args, array(
                    'add_below' => 'div-comment',
                    'depth'     => $depth,
                    'max_depth' => $args['max_depth'],
                    'before'    => '<div class="reply">',
                    'after'     => '</div>'
                )));
                if ($comment->comment_approved == '0') {
                    echo '<div class="ui basic label">' . esc_html__('Your comment is awaiting moderation.', 'fanspaysite') . '</div>';
                }
                ?>
            </div>
        </div>
    </<?php echo $tag; ?>>
    <?php
}
