Fix WooCommerce checkbox input
Problem: Calling `woocommerce_form_field()` for input type `checkbox` results in a hidden checkbox. Fix: Adjust the `understrap_wc_form_field_args` filter to make `woocommerce_form_field()` render valid Bootstrap markup.
This commit is contained in:
parent
44cc2383bd
commit
ab3fe5b52f
|
|
@ -122,10 +122,13 @@ if ( ! function_exists( 'understrap_wc_form_field_args' ) ) {
|
|||
$args['input_class'] = array( 'form-control' );
|
||||
break;
|
||||
case 'checkbox':
|
||||
// Add a class to the form input's <label> tag.
|
||||
$args['label_class'] = array( 'custom-control custom-checkbox' );
|
||||
$args['input_class'] = array( 'custom-control-input' );
|
||||
break;
|
||||
$args['class'][] = 'form-group';
|
||||
// Wrap the label in <span> tag.
|
||||
$args['label'] = isset( $args['label'] ) ? '<span class="custom-control-label">' . $args['label'] . '<span>': '';
|
||||
// Add a class to the form input's <label> tag.
|
||||
$args['label_class'] = array( 'custom-control custom-checkbox' );
|
||||
$args['input_class'] = array( 'custom-control-input' );
|
||||
break;
|
||||
case 'radio':
|
||||
$args['label_class'] = array( 'custom-control custom-radio' );
|
||||
$args['input_class'] = array( 'custom-control-input' );
|
||||
|
|
|
|||
Loading…
Reference in New Issue