Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My page in question is here.

I have tried to add a comments.php to my custom theme so I can remove the website field and so I could edit the default values of the fields and remove the labels. When I add a comments.php all of my comments disappear and the comments are no longer functional. I have no idea how to make these modifications.

I've tried editing comments-template.php but removing the field in that file doesn't remove it from the site, I am assuming because it is already in the database.

I am new to PHP so any details on how I can get these text fields edited would be great.

share|improve this question
    
You might get help with this and this. If you are not having a comment.php, you can create one. –  Rohit Pande Jan 17 '13 at 10:11
    
If you create a blank comments.php, WordPress supposes that it has nothing to do there. Try inserting the code from the twentytwelve theme, and modify it. –  fischi Jan 17 '13 at 10:35

2 Answers 2

up vote 1 down vote accepted

A little late, but you could also add the following to your theme's functions.php file:

    /** Comment Form Function Defaults */
    add_filter('comment_form_defaults','my_comment_defaults');
    function my_comment_defaults($defaults) {
        global $user_identity, $id;
        if ( isset($post_id) )
            $id = $post_id;
        else
            $post_id = $id;
        $commenter = wp_get_current_commenter();
        $req = get_option( 'require_name_email' );
        $aria_req = ( $req ? " aria-required='true'" : '' );
        $fields =  array(
            'author' => '<div class="comment-form-author">' . '<label for="author">' . __( 'Name:' ) . ( $req ? ' <span class="required">*</span>' : '' ) .
                        '</label><input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></div>',
            'email'  => '<div class="comment-form-email"><label for="email">' . __( 'Email:' ) . ( $req ? ' <span class="required">*</span>' : '' ) .
                        '</label><input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></div>',
            'url'    => '',
        );
        $required_text = sprintf( ' ' . __('Required fields are marked %s'), '<span class="required">*</span>' );
        $defaults = array(
            'fields'               => apply_filters( 'comment_form_default_fields', $fields ),
            'comment_field'        => '<div class="comment-form-comment"><label for="comment">' . _x( 'Comment:', 'noun' ) . ' <span class="required">*</span></label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></div>',
            'must_log_in'          => '<p class="must-log-in">' .  sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
            'logged_in_as'         => '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
            'comment_notes_before' => '<p class="comment-notes"><em>Note: </em>' . __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . '</p>',
            'comment_notes_after'  => '<p class="form-allowed-tags">' . sprintf( __( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s' ), ' <code>' . allowed_tags() . '</code>' ) . '</p>',
            'id_form'              => 'commentform',
            'id_submit'            => 'submit',
            'title_reply'          => __( 'Leave a Reply' ),
            'title_reply_to'       => __( 'Leave a Reply to %s' ),
            'cancel_reply_link'    => __( 'Cancel reply' ),
            'label_submit'         => __( 'Post Comment' ),
        );
        return $defaults;
    }

This could be a bit of overkill, but it also will give you control over the other fields and attributes of the comment form.

share|improve this answer

There are multiple solutions for your question.

  1. Using the CSS trick

    Use #commentform .comment-form-url {display:none;} for not displaying the website field.

  2. Commenting the code

    look in your theme's comments.php for a line like or similar to:

    <p><input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22" tabindex="3" /> <label for="url"><small>Website</small></label></p>

comment it out or delete it

p.s. always back up file 1st before edit.

3.Use following tutorial

Wordpress How To Remove The Website Field From The Comment Form

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.