The cause and solution would be theme specific, so we couldn’t say for sure. As a guess, you replaced the call to comments_template()
with the code from your theme’s comments.php template file. comments_template()
does a lot more than include comments.php, it makes a comments query and sets up several variables the template uses. By substituting, you’ve apparently taken out that critical functionality. At the very least you may need $comments = get_comments();
but it may take more than that.
Why are you trying to merge template code into the same file anyway?