Adding Bootstrap button markup

This commit is contained in:
Holger 2016-02-23 08:48:27 +01:00
parent ed7b02ca2f
commit 010e99dc5e
1 changed files with 3 additions and 6 deletions

View File

@ -21,14 +21,11 @@
add_filter( 'comment_form_defaults', 'bootstrap3_comment_form' ); add_filter( 'comment_form_defaults', 'bootstrap3_comment_form' );
function bootstrap3_comment_form( $args ) { function bootstrap3_comment_form( $args ) {
$req = get_option( 'require_name_email' );
$args['comment_field'] = '<div class="form-group comment-form-comment"> $args['comment_field'] = '<div class="form-group comment-form-comment">
<label for="comment">' . _x( 'Comment', 'noun', 'understrap' ) . ( ' <span class="required">*</span>' : '' ) . '</label> <label for="comment">' . _x( 'Comment', 'noun', 'understrap' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label>
<textarea class="form-control" id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea> <textarea class="form-control" id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>
</div>'; </div>';
$args['class_submit'] = 'btn btn-default'; // since WP 4.1
return $args; return $args;
} }
add_action('comment_form', 'bootstrap3_comment_button' );
function bootstrap3_comment_button() {
echo '<button class="btn btn-default" type="submit">' . __( 'Submit' ) . '</button>';
}