Comment Form
-
I’d like to know how to edit comments.php in order to display the Name, Email, Website and Leave a Comment fields. I have read that this is the default behavior, and I’m very new to WordPress, but my comment form is only displaying the Leave a comment field.
I have located the “comment_form” area of this php, but the following could looks a mess if you ask me (And I don’t understand this code anyway)
I’d be very grateful if someone could paste in some code for me to copy and tell me exactly where to copy it.
The comment_form” part of my comments-php file currently looks like this:
$custom_comment_field = ‘<textarea class=”full” placeholder=”‘.__(‘Leave a comment’, ‘loc_canon’).'” id=”comment” name=”comment” cols=”20″ rows=”5″ aria-required=”true”></textarea>’; //label removed for cleaner layout
//vars for fields
$commenter = wp_get_current_commenter();
$req = get_option( ‘require_name_email’ );
$aria_req = ( $req ? ” aria-required=’true'” : ” );comment_form(array(
‘fields’ => apply_filters( ‘comment_form_default_fields’, array(
‘author’ => sprintf(‘<input placeholder=”%s” id=”author” name=”author” type=”text” value=”%s” %s/>’
, esc_attr(__(‘Name’, ‘loc_canon’))
, esc_attr( $commenter[‘comment_author’] )
, esc_attr($aria_req)
),
’email’ => sprintf(‘<input placeholder=”%s” id=”email” name=”email” type=”text” value=”%s” %s/>’
, esc_attr(__(‘Email’, ‘loc_canon’))
, esc_attr( $commenter[‘comment_author_email’] )
, esc_attr($aria_req)
),
‘url’ => sprintf(‘<input placeholder=”%s” id=”url” name=”url” type=”text” value=”%s”/>’
, esc_attr(__(‘Website’, ‘loc_canon’))
, esc_attr( $commenter[‘comment_author_url’] )
),
)),
‘comment_field’ => $custom_comment_field,
‘comment_notes_before’ => ”,
‘comment_notes_after’ => ”,
‘logged_in_as’ => ”,
‘title_reply’ => ”,
‘cancel_reply_link’ => __(‘<em class=”fa fa-times”> Cancel reply’, ‘loc_canon’),
‘label_submit’ => __(‘Submit Comment’, ‘loc_canon’)
The topic ‘Comment Form’ is closed to new replies.