ninusik
ninusik

Reputation: 235

wp_list_comments() not working

I've created a custom theme from scratch, nothing fancy, simple theme. I'm currently using Wordpress 3.2.1. I put wp_list_comments() in the comments.php to list the comments, and it doesn't work at all! No comments displayed. Tried putting it in single.php, tried also deactivating all the plugins - still nothing. I used the default function, just wp_list_comments(); with no arguments. Could anybody suggest why it might be not working?

Upvotes: 7

Views: 11413

Answers (3)

Shawn DeWolfe
Shawn DeWolfe

Reputation: 111

My resolution was to load the comments and include them as the argument in the wp_list_comments() function call. In this case, it's to include Woocommerce comments and their associated formatting.

<?php
$comments = get_comments( array('post_id' => get_the_id()) );
?>
<ol class="commentlist">
    <?php wp_list_comments( apply_filters( 'woocommerce_product_review_list_args', array( 'callback' => 'woocommerce_comments' ) ), $comments ); ?>
</ol>

Upvotes: 0

aleXela
aleXela

Reputation: 1301

I had same problem. I added

<?php include('comments.php')?>

and comments started to appear.

Upvotes: 0

Chris Carson
Chris Carson

Reputation: 1845

Did you try <?php comments_template(); ?> in single.php? You seem to imply in your comment above that you were doing something like <?php include('comments.php')?> This won't work, because the comments haven't been queried from the database--comments_template() does that, then includes comments.php in your theme root.

Does that help?

Upvotes: 23

Related Questions