Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WordPress Comments Fields with Bootstrap classes
<div class="row">
<div class="col-md-8 comment-form">
<?php
$fields = array(
'author' =>
'<div class="form-group"><label for="author">' . __( 'Name', 'domainreference' ) . '</label> <span class="required">*</span> <input id="author" name="author" type="text" class="form-control" value="' . esc_attr( $commenter['comment_author'] ) . '" required="required" /></div>',
'email' =>
'<div class="form-group"><label for="email">' . __( 'Email', 'domainreference' ) . '</label> <span class="required">*</span><input id="email" name="email" class="form-control" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" required="required" /></div>',
'url' =>
'<div class="form-group last-field"><label for="url">' . __( 'Website', 'domainreference' ) . '</label><input id="url" name="url" class="form-control" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" /></div>'
);
$args = array(
'class_submit' => 'btn btn-block btn-lg btn-info',
'label_submit' => __( 'Submit Comment' ),
'comment_field' =>
'<div class="form-group"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label> <span class="required">*</span><textarea id="comment" class="form-control" name="comment" rows="2" required="required"></textarea></div>',
'fields' => apply_filters( 'comment_form_default_fields', $fields )
);
comment_form( $args );
?>
</div>
</div>
@robertbiswas

This comment has been minimized.

Copy link

@robertbiswas robertbiswas commented Jun 21, 2018

Nicely done. Thank you.

@AbmSourav

This comment has been minimized.

Copy link
Owner Author

@AbmSourav AbmSourav commented Jul 9, 2018

Welcome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.