Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

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); ?>
share|improve this question
    
The file is named comments.php usually. You can use another name, but that is not required. Add the code of your comment file to the question. –  toscho Oct 22 '12 at 3:35

1 Answer 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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.