Anthony
Anthony

Reputation: 3

Wordpress comment_form(); not working correctly

I am trying to modify the fields on my Wordpress comment form using the following code:

<?php $fields =  array(
    'comment_notes_after' => '',
    'title_reply'=>'Let me know what you think',
    'author' => '<p class="comment-form-author">' . '<input class="text" id="author" name="author" type="text" value="Name *" size="30" onfocus="if(this.value==\'Name *\') this.value=\'\';this.style.color=\'#FFF\';" onblur="if(this.value==\'\') this.value=\'Name *\';this.style.color=\'#00AEEF\';"' . $aria_req . ' /></p>',
    'email'  => '<p class="comment-form-email">' .           '<input id="email" name="email" type="text" value="Email *" size="30" onfocus="if(this.value==\'Email *\') this.value=\'\';this.style.color=\'#FFF\';" onblur="if(this.value==\'\') this.value=\'Email *\';this.style.color=\'#00AEEF\';"' . $aria_req . ' /></p>',
    'url'   => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label>' . '<input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>',
    'comment_field' => '<p class="comment-form-comment"><!--<label for="comment">' . _x( 'Comment', 'noun' ) . '</label>--><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true" onfocus="if(this.value==\'Comment\') this.value=\'\';this.style.color=\'#FFF\';" onblur="if(this.value==\'\') this.value=\'Comment\'" ' . $aria_req . '>Comment</textarea></p>',   
); 

comment_form($fields);
?>

The problem I am having is that the author, email and url fields are not responding to my changes. The comment textarea responds, but even if I put ridiculous test values in the 3 problematic fields it ignores it completely.

Any help would be greatly appreciated.

Upvotes: 0

Views: 1793

Answers (1)

soju
soju

Reputation: 25302

You should take a look at codex : http://codex.wordpress.org/Function_Reference/comment_form

You will see that there are no author, email and url params, you have to use fields param :

$args = array (
  'fields' => array(
    'author' => ...
    'email' => ...
    'url' => ...
  ),
  ...
);
comment_form($args);

Upvotes: 1

Related Questions