how to properly use comments-template.php

I want to modify comments form for both logged in users, and for those who are not.

I modified the form for those who are not logged in by changing my comments.php but I’m not quite sure how to modify my form for logged in users. I know I have to use comments_template(), but when ever I try to use it in my page.php, I get errors like this

Read More
Notice: Undefined variable: args in {PATH}/twwr-theme/comments-template.php on line 13 

these are the contents of my comments.php, its a bit messy

<?php
if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    die ('Please do not load this page directly. Thanks!');

if ( post_password_required() ) {
    echo "This post is password protected. Enter the password to view comments.";
    return;
}
?>
<h3><?php comments_number('No Comments', 'One Comment', 'Comments' );?></h3>

<div class="navigation">
    <div class="next-posts"><?php previous_comments_link() ?></div>
    <div class="prev-posts"><?php next_comments_link() ?></div>
</div>

<ul class="commentlist">
    <?php //comment layout is in functions.php ?>
    <?php wp_list_comments('callback=comment_layout'); ?>
</ul>

<div class="navigation">
    <div class="next-posts"><?php previous_comments_link() ?></div>
    <div class="prev-posts"><?php next_comments_link() ?></div>
</div>
<?php if ( comments_open() ) : ?>
    <!-- If comments are open, but there are no comments. -->

 <?php else : // comments are closed ?>
    <p>Comments are closed.</p>

<?php endif; ?>

ID);
?>

Related posts

Leave a Reply

1 comment

  1. It depends on how your theme is built & we can’t be 100% sure if this is right without seeing the code but most probably comments_template is the wrong function. Take a look at the comment_form function http://codex.wordpress.org/Function_Reference/comment_form

    comments_template is the function generally used to include the comments file(basically to display the contents of comments.php, though this can be changed)

    Again, it’s possible for the theme to use comments_template for displaying the form & if the above doesn’t work for you, please post the code