2012-09-06 47 views
0

我嘗試使用下面的代碼修改我的WordPress評論表單上的字段:Wordpress comment_form();工作不正常

<?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); 
?> 

我遇到的問題是,作者,電子郵件和URL字段不迴應我的變化。評論textarea迴應,但即使我在3個有問題的領域放棄荒謬的測試值,它完全忽略它。

任何幫助將不勝感激。

回答

0

你應該看看抄本:http://codex.wordpress.org/Function_Reference/comment_form

你會看到,有沒有authoremailurl PARAMS,你必須使用fields PARAM:

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

我有一點的一個noob - codex頁面讓我失望了一下。謝謝你的幫助和明確的回答,燒酒。 – Anthony