I’m simply typing wp_list_comments() in page.php but nothing is shown. But if I put the comments_template() tag there, then the comment form, comments and pings are shown. Why is that, why can’t I use wp_list_comments() in page.php? What could I have done wrong?
Leave a Reply
You must be logged in to post a comment.
You need to include comments functionality via
comments_template()
, because this function doesn’t merely include thecomments.php
, file, but also handles all of the querying and functions required for displaying comments.While the Codex doesn’t really get into details, you can see, by looking at source, what’s going on:
Try enclosing wp_list_comments() like this:
comments_template() simply loads comments.php which makes use of wp_list_comments in an enclosing CSS class.
HTH