Mariano Grandioso
Mariano Grandioso

Reputation: 1205

have_comments() returns false [with comments_template()]

My wordpress installation is behaving very strangely. First the recent posts stopped working, now this...

I'm working on my custom wordpress theme and I got stuck on the comments. Actually, I just copied the code for the comments template and the 3 functions from this tutorial.

I found a solution that says I should call the template with comments_template() instead of the general include method and that is how I do it. It still doesn't show a single comment, even though get_comments_number() returns 2 and I see the comments in the dashboard.

Any ideas ?

Upvotes: 3

Views: 3506

Answers (1)

vaso123
vaso123

Reputation: 12391

I did suck with this also 5 mins ago.

Yes, you should call this comments_template() function.

Call it like this:

comments_template( '', true);

and then make a comments.php in your theme directory, and do the

 if (have_comments()) {
    ...
}

cycle.

It should work.

Upvotes: 7

Related Questions