WordPress not using correct comments file?

Does anyone with experience using WordPress know why it would not use my comments.php file that is in a theme folder?

Related posts

Leave a Reply

5 comments

  1. I got it working now, I had to change

    <?php comments_template(); ?>

    into this

    <?php comments_template('', true); ?> 
    

    instead, weird but it fixed my problem

  2. If you already have <?php comments_template(); ?> in place (which you do) then it could be a file permission issue.

    Also, it is probably pulling from classic or default if it can’t read your comments.php file in the current directory of your theme.

    Make sure your comments.php has the same permissions as the rest of your theme files.

  3. You need to include the following in your template’s single.php to include comments:

    <?php comments_template(); ?>
    

    Use the default template that comes with WordPress as a reference.

    Doug Neiner added this as a comment first so if he posts it as an answer please choose his.

  4. I think I found solution.
    Problem that my theme not using single.php while it loads. So adding comments_template(”, true); not helping.

    So I added it to my index.php file and it appears now like it should.

    Hope this will help

  5. This is typically done with the comments_template function:

    <?php comments_template($file, $separate_comments); ?> 
    

    $file is the file name you want to load (for example, “/comments.php”). It’s an optional parameter.

    $separate_comments is used to set whether to separate the comments by comment type. It’s boolean, and the default is FALSE. It’s an optional parameter (if you omit it, it’s set to FALSE).

    NOTE: This only works for single posts and pages. To make it work everywhere, set $withcomments to “1”.

    If you want to create your own custom comment template (like for a custom theme), call it like this, for example (“short-comments” is just an example name):

    <?php comments_template( '/short-comments.php' ); ?>
    

    If you’ve done all this and WP still isn’t using the correct comments.php, check file permissions. Also–hacking comments is a common problem, so someone may have hacked your site and caused a problem with the file.