I am working on a self-made theme and I have an issue where all of the comments are showing up on all the posts, instead of each post only showing their own comments.
I am using this code to display comments:
<?php if (have_posts()): ?>
<?php while (have_posts()): ?>
<?php the_post(); ?>
// The title, content and some other html here
wp_list_comments(array( 'callback' => 'comments_callback'), get_comments());
<?php endwhile; ?>
<?php endif; ?>
And I have tried to both put this line inside and outside the loop, and still get the same result. I got com comments_callback funktion in a mu-plugins and the code for it looks like this:
<?php
function comments_callback( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
?>
<div class="the-comment">
<div class="blog-comment-avatar">
<i class="fa fa-user" aria-hidden="true"></i>
</div>
<div class="comment-text">
<p class="text-secondary comment-author"><?php comment_author(); ?></p>
<?php comment_text(); ?>
</div>
</div>
<?php
}
?>
What am I doing wrong here?