2012-09-16 67 views
0

我試圖讓我的wordpress主題,看起來像這樣:WordPress的comment_form功能

<input id="author" class="inputsection" name="author" type="text" onfocus=" if (this.value == 'name...') {this.value = '';}" value="name..." /> 

<input id="email" class="inputsection_right" name="email" type="text" onfocus=" if (this.value == 'email...') {this.value = '';}" value="email..." /> 

<textarea id="comment" name="comment" cols="5" rows="5" class="inputlargesection"></textarea> 

<input name="submit" type="submit" value="Submit" class="formbutton"> 

我使用的WordPress的要求爲標準comment_form()函數。

這是怎麼了我這樣做:

<?php 

comment_form(

array(
    'author' => "<input id=\"author\" class=\"inputsection\" name=\"author\" type=\"text\" onfocus=\" if (this.value == 'name...') {this.value = '';}\" value=\"name...\" />", 
    'email' => "<input id=\"email\" class=\"inputsection_right\" name=\"email\" type=\"text\" onfocus=\" if (this.value == 'email...') {this.value = '';}\" value=\"email...\" />", 
    'url' => false, 
    'comment_field' => '<textarea id="comment" name="comment" cols="5" rows="5" class="inputlargesection" aria-required="true"></textarea>' 
) 

) ; 

?> 

但是,這是行不通的。

我如何使它看起來像我以後。沒有其他元素,沒有代碼允許的文本等

我一直在通過wordpress codex和谷歌排序,我沒有找到我所需要的。

回答

1

看起來像場應額外陣列放:

<?php 

comment_form(array(

    'fields' => array(
     'author' => "<input id=\"author\" class=\"inputsection\" name=\"author\" type=\"text\" onfocus=\" if (this.value == 'name...') {this.value = '';}\" value=\"name...\" />", 
     'email' => "<input id=\"email\" class=\"inputsection_right\" name=\"email\" type=\"text\" onfocus=\" if (this.value == 'email...') {this.value = '';}\" value=\"email...\" />", 
     'url' => false, 
    ), 
    'comment_field' => '<textarea id="comment" name="comment" cols="5" rows="5" class="inputlargesection" aria-required="true"></textarea>' 

)); 

?>