Robert Gouveia
Robert Gouveia

Reputation: 21

Wordpress comment_form function

i am trying to get my wordpress theme to look like this:

<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">

I am using the standard comment_form() function which wordpress asks for.

This is how i have done this:

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

) ; 

?>

But this is not working.

How do i make it so it looks like what i am after. no other elements, no code allowed text etc.

Ive been sorting through both wordpress codex and google and i am not finding exactly what i need.

Upvotes: 0

Views: 242

Answers (1)

Krycke
Krycke

Reputation: 3186

looks like the fields should be put in an extra array:

<?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>'

) ); 

?>

Upvotes: 1

Related Questions