'
',
'email' => '
',
'url' => '
',
);
if ( has_action( 'set_comment_cookies', 'wp_set_comment_cookies' ) && get_option( 'show_comments_cookies_opt_in' ) ) {
$consent = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"';
$fields['cookies'] = '
';
}
return $fields;
}
add_filter( 'comment_form_default_fields', 'bootstrap5_comment_fields' );
/**
* Reorder fields in comments form
*
* @param array $fields Array of comment form fields, including the textarea.
* @return array
*/
function bootstrap5_comment_reorder_fields( $fields ) {
$comment_field = $fields['comment'];
$cookie_field = $fields['cookies'];
unset( $fields['comment'] );
unset( $fields['cookies'] );
$fields['comment'] = $comment_field;
$fields['cookies'] = $cookie_field;
return $fields;
}
add_filter( 'comment_form_fields', 'bootstrap5_comment_reorder_fields' );
/**
* Customize submit button in comments form
*
* @param string $submit_field HTML markup for the submit field.
* @return string
*/
function bootstrap5_comment_submit_field( $submit_field ) {
$textarea_field = '
' . $submit_field . '
';
return $textarea_field;
}
add_filter( 'comment_form_submit_field', 'bootstrap5_comment_submit_field' );