Created
November 13, 2013 16:12
-
-
Save robdvr/7451695 to your computer and use it in GitHub Desktop.
Adding Bootstrap Forms to WooCommerce
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('woocommerce_billing_fields', 'custom_woocommerce_billing_fields'); | |
function custom_woocommerce_billing_fields( $fields ) { | |
$fields['billing_address_1']['class'] = array( 'form-group' ); | |
$fields['billing_address_1']['input_class'] = array( 'form-control' ); | |
return $fields; | |
} |
Adding this for ages– builds upon the previous examples, hitting every input and adding form-group
to the container, and form-control
to the input. It also appends to the class arrays instead of overwrites, this might help avoid plugin conflicts.
add_filter('woocommerce_form_field_args', function ($args, $key, $value) {
$args['input_class'][] = 'form-control';
$args['class'][] = 'form-group';
return $args;
}, 10, 3);
This is great, but only applies to the actual checkout - is there a straightforward way at all of doing this sitewide?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
try this