Support » Fixing WordPress » Customizing Comments Form?

  • I’m trying to figure out where i can edit the comment form section (the part that when a user is allowed to leave a comment on a post, the form they are presented with). My form right now says the default (I’m guessing):

    Leave a Reply
    Your email address will not be published. Required fields are marked *
    Name *
    Email *
    You may use these HTML tags and attributes: <abbr title=””> <acronym title=””> <b>

    <cite> <del datetime=""> <i> <q cite=""> <strike>

    How can I change the look of this form? The fields displayed, the spacing, etc.? I just want to totally customize how it looks. I have been looking through the functions.php and comments.php file, and cannot find the part that looks like this form. Where is this section of code at?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Michael


    Forum Moderator

    have a look into comments.php of your theme

    So currently my site is using the default:

    <?php comment_form(); ?>

    So if I change that line to this:

    <?php comment_form( $args, $post_id ); ?>

    How exactly do I change the parameters?

    It shows he default input terms like this:

    $fields = array(
    ‘author’ => ‘<p class=”comment-form-author”>’ . ‘<label for=”author”>’ . __( ‘Name’ ) . ‘</label> ‘ . ( $req ? ‘<span class=”required”>*</span>’ : ” ) .
    ‘<input id=”author” name=”author” type=”text” value=”‘ . esc_attr( $commenter[‘comment_author’] ) . ‘” size=”30″‘ . $aria_req . ‘ /></p>’,
    ’email’ => ‘<p class=”comment-form-email”><label for=”email”>’ . __( ‘Email’ ) . ‘</label> ‘ . ( $req ? ‘<span class=”required”>*</span>’ : ” ) .
    ‘<input id=”email” name=”email” type=”text” value=”‘ . esc_attr( $commenter[‘comment_author_email’] ) . ‘” size=”30″‘ . $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>’,
    ); ?>

    But where would i find this particular block of code in order to customize it?



    Forum Moderator

    This is all I have in my comments.php page:

    [code moderated as per forum rules – please use the pastebin.

    naming the theme would work here as well, because you are working with a so far unmodified default theme]

    It doesn’t really look like what was in the example you sent me is what is in my comments.php page 🙁 Any suggestions?

    I also do not see the part in my functions.php page where I can customize as the author of that article has suggested:


    [code moderated as per forum rules – please use the pastebin.

    same here: naming the theme would work, because you are working with a so far unmodified default theme]



    Forum Moderator

    your question so far is very general, therefore, the link is meant as an example how to get working with the ‘comment_form()’ arguments – not as an example what to look out for.

    Well, I understand it’s kind of a general question, but I have been having trouble finding where I would find the area of my comment.php page or whichever page, the comment form would be on where I could customize it. Can anyone please help?

    I have been reading this tutorial on customizing the comment form:

    I am having trouble understanding a few things. It says in order to makes adjustments to either the form itself or the CSS for the form, to follow the guidelines explained in the article, but I am having trouble because I could not find the comment_form() function in my functions.php page. If I am to make adjustments to this function, will I have to just create it? It looks like I would jst do this to create it:

    function comment_form( $args, $post_id ); {


    But 1) how do I set up the $args array? It shows this in the next part of the article:

    <?php comment_form(
    		'cancel_reply_link' => __( 'Cancel reply' ),
    		'label_submit' => __( 'Post Comment' ),
    ); ?>

    Do I just type this in next and set my arguments in there?

    I want to customize the CSS of the form. 2) How do I know the names of the fields that I want to modify? I am not going to be adding any new fields, just using the defaults that are already there. The only other thing I want to do is make the comment field required, as it currently doesn’t look like it’s required. Can someone please help me understand this better?

    I’m totally struggling with this also.

    The tutorials and information is a bit complex.

    Add this in your css file to remove “You may use html tags” so it disappears… n may i know what changes you are requiring to change your form like… I am using too a custom form on my web check out here…

    Add this to you css file

    .form-allowed-tags {
    display: none;

    The fields are changed from PHP template modification while the looks spacing and other styling is done via css…

    Can u give me an idea what type of changes u want so i can be specific helping u… 🙂 Dont worry i too had tons of problems including the same prob u are having hahaha 😀 but i somehow figured it out…

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Customizing Comments Form?’ is closed to new replies.