<!--FansPaysite/comments.php-->
<?php
if ( post_password_required() ) {
	return;
}

if (have_comments()) : ?>
    <h2 class="ui header comments-title">
        <?php
        $fanspaysite_comment_count = get_comments_number();
        if ('1' === $fanspaysite_comment_count) {
            printf(
                esc_html__('One comment on &ldquo;%1$s&rdquo;', 'fanspaysite'),
                '<span>' . get_the_title() . '</span>'
            );
        } else {
            printf(
                esc_html(_nx('%1$s comment on &ldquo;%2$s&rdquo;', '%1$s comments on &ldquo;%2$s&rdquo;', $fanspaysite_comment_count, 'comments title', 'fanspaysite')),
                number_format_i18n($fanspaysite_comment_count),
                '<span>' . get_the_title() . '</span>'
            );
        }
        ?>
    </h2>
    <div class="ui comments">
        <ul class="comment-list">
            <?php
                    wp_list_comments(array(
                        'style'       => 'ul',
                        'short_ping'  => true,
                        'avatar_size' => 100, // Adjust the avatar size as needed
                        'callback'    => 'fanspaysite_comment_callback'
                    ));
            ?>
        </ul>
        <?php the_comments_navigation(); ?>
    </div>
    <?php if (!comments_open()) : ?>
        <div class="ui message no-comments">
            <p><?php esc_html_e('Comments are closed.', 'fanspaysite'); ?></p>
        </div>
    <?php endif; ?>
<?php endif; ?>

<div class="ui segment">
    <?php comment_form([
        'class_form'           => 'ui form', // Applies Fomantic UI form styling
        'class_submit'         => 'ui button', // Applies Fomantic UI button styling
        'title_reply_before'   => '<h3 class="ui dividing header">', // Fomantic UI header for the reply title
        'title_reply_after'    => '</h3>',
    ]); ?>
</div>
