WordPress.org

Ready to get started?Download WordPress

Forums

How to add some br tags to comments form (2 posts)

  1. skunkbad
    Member
    Posted 3 years ago #

    I've edited /wp-includes/comments-template.php so that I have some br tags between the form labels and the input elements, but I know this is wrong because it should be somewhere in the theme files. How would I properly customize/extend the comments_form function? Do I just copy and paste the comments form function to my functions.php file, and make my changes there?

  2. skunkbad
    Member
    Posted 3 years ago #

    I figured it out myself. I just added in some arguments to the function call:

    <?php
        comment_form(
            array(
                'fields' => array(
                                'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
                                            '<br />
                                            <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>' : '' ) .
                                            '<br />
                                            <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>' .
                                            '<br />
                                            <input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>',
                )
            )
        );
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic