Title: have_comments() HELP
Last modified: August 19, 2016

---

# have_comments() HELP

 *  [dColumbus](https://wordpress.org/support/users/dcolumbus/)
 * (@dcolumbus)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/have_comments-help/)
 * So I’m experiencing something really ridiculous… within my comments.php loop 
   I am logically calling:
 * `<?php if ( have_comments() ) : ?>`
 * The problem is, it isn’t working at all… it never thinks there’s any comments.
   I’m automatically dumped into the else part of the statement…
 * FYI: I do not have a function.php
 * Help?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/have_comments-help/#post-1081330)
 * I’ve used `<?php if(have_comments()) : ?>` dozens of times without any problem.
   So perhaps the problem is elsewhere in your code.
 *  [donut2d](https://wordpress.org/support/users/donut2d/)
 * (@donut2d)
 * [17 years ago](https://wordpress.org/support/topic/have_comments-help/#post-1081468)
 * I ran into this problem as well. It’s not that it never works, it’s that it will
   always return false until after `comments_template()` is called. I’m not sure
   why this doesn’t use the same method as `comments_number()`, but it doesn’t and
   it sucks. What you should be able to use instead is `get_comments_number()` which
   returns the number of comments.
 * I know this was posted a month ago, but hopefully it will save someone like me
   some time.
 *  [daneharrigan](https://wordpress.org/support/users/daneharrigan/)
 * (@daneharrigan)
 * [17 years ago](https://wordpress.org/support/topic/have_comments-help/#post-1081484)
 * The `$comments` variable is boolean. It will either be `true` or `false`. Within
   your post loop it will have one of the two values. That’s purely an indicator
   of whether or not comments are allowed.
 * The other functions such as `have_comments()` and `wp_list_comments()` don’t 
   contain any data until `comments_template()` is processed.
 * `comments_template()` makes the appropriate calls to retrieve the comments data,
   but it also includes the comments.php file.
 * Don’t do:
 *     ```
       if($comments)
         include(TEMPLATEPATH . '/comments.php');
       ```
   
 * Instead do:
 *     ```
       if($comments)
         comments_template();
       ```
   
 * Hope that helps,
 * -Dane

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘have_comments() HELP’ is closed to new replies.

## Tags

 * [Comments](https://wordpress.org/support/topic-tag/comments/)
 * [comments_template](https://wordpress.org/support/topic-tag/comments_template/)
 * [have_comments()](https://wordpress.org/support/topic-tag/have_comments/)

 * 3 replies
 * 4 participants
 * Last reply from: [daneharrigan](https://wordpress.org/support/users/daneharrigan/)
 * Last activity: [17 years ago](https://wordpress.org/support/topic/have_comments-help/#post-1081484)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
