WordPress.org

Ready to get started?Download WordPress

Forums

Customizing Comments Form? (13 posts)

  1. twilitegxa
    Member
    Posted 3 years ago #

    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 *
    Website
    Comment
    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?

  2. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    have a look into comments.php of your theme

    http://codex.wordpress.org/Function_Reference/comment_form

  3. twilitegxa
    Member
    Posted 3 years ago #

    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:

    <?php
    $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?

  4. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

  5. twilitegxa
    Member
    Posted 3 years ago #

    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]

  6. twilitegxa
    Member
    Posted 3 years ago #

    It doesn't really look like what was in the example you sent me is what is in my comments.php page :-( Any suggestions?

  7. twilitegxa
    Member
    Posted 3 years ago #

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

    functions.php:

    [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]

  8. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    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.

  9. twilitegxa
    Member
    Posted 3 years ago #

    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?

  10. twilitegxa
    Member
    Posted 3 years ago #

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

    http://devpress.com/blog/using-the-wordpress-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(
    	array(
    		'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?

  11. Theme 7 dot net
    Member
    Posted 3 years ago #

    I'm totally struggling with this also.

    The tutorials and information is a bit complex.

  12. Janu Studio
    Member
    Posted 3 years ago #

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

    http://www.rockpakistani.com/sports/barcelona-sees-real-madrid

    Add this to you css file

    .form-allowed-tags {
    display: none;
    }
  13. Janu Studio
    Member
    Posted 3 years ago #

    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 :D but i somehow figured it out...

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.