Add pluggable function wrappers to inc/woocommerce.php
This commit is contained in:
parent
c75682937e
commit
140da01e60
|
@ -4,6 +4,8 @@
|
||||||
*
|
*
|
||||||
* @package understrap
|
* @package understrap
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
add_action( 'after_setup_theme', 'understrap_woocommerce_support' );
|
add_action( 'after_setup_theme', 'understrap_woocommerce_support' );
|
||||||
if ( ! function_exists( 'understrap_woocommerce_support' ) ) {
|
if ( ! function_exists( 'understrap_woocommerce_support' ) ) {
|
||||||
/**
|
/**
|
||||||
|
@ -22,6 +24,7 @@ if ( ! function_exists( 'understrap_woocommerce_support' ) ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* First unhook the WooCommerce wrappers
|
* First unhook the WooCommerce wrappers
|
||||||
*/
|
*/
|
||||||
|
@ -54,6 +57,7 @@ function understrap_woocommerce_wrapper_end() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter hook function monkey patching form classes
|
* Filter hook function monkey patching form classes
|
||||||
* Author: Adriano Monecchi http://stackoverflow.com/a/36724593/307826
|
* Author: Adriano Monecchi http://stackoverflow.com/a/36724593/307826
|
||||||
|
@ -64,7 +68,8 @@ function understrap_woocommerce_wrapper_end() {
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function understrap_wc_form_field_args( $args, $key, $value = null ) {
|
if ( ! function_exists ( 'understrap_wc_form_field_args' ) ) {
|
||||||
|
function understrap_wc_form_field_args( $args, $key, $value = null ) {
|
||||||
// Start field type switch case.
|
// Start field type switch case.
|
||||||
switch ( $args['type'] ) {
|
switch ( $args['type'] ) {
|
||||||
/* Targets all select input type elements, except the country and state select input types */
|
/* Targets all select input type elements, except the country and state select input types */
|
||||||
|
@ -130,6 +135,7 @@ function understrap_wc_form_field_args( $args, $key, $value = null ) {
|
||||||
break;
|
break;
|
||||||
} // end switch ($args).
|
} // end switch ($args).
|
||||||
return $args;
|
return $args;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,7 +143,10 @@ function understrap_wc_form_field_args( $args, $key, $value = null ) {
|
||||||
* Change loop add-to-cart button class to Bootstrap
|
* Change loop add-to-cart button class to Bootstrap
|
||||||
*/
|
*/
|
||||||
add_filter( 'woocommerce_loop_add_to_cart_args', 'understrap_woocommerce_add_to_cart_args', 10, 2 );
|
add_filter( 'woocommerce_loop_add_to_cart_args', 'understrap_woocommerce_add_to_cart_args', 10, 2 );
|
||||||
function understrap_woocommerce_add_to_cart_args( $args, $product ) {
|
|
||||||
|
if ( ! function_exists ( 'understrap_woocommerce_add_to_cart_args' ) ) {
|
||||||
|
function understrap_woocommerce_add_to_cart_args( $args, $product ) {
|
||||||
$args['class'] = str_replace('button','btn btn-outline-primary', 'button');
|
$args['class'] = str_replace('button','btn btn-outline-primary', 'button');
|
||||||
return $args;
|
return $args;
|
||||||
|
}
|
||||||
}
|
}
|
Reference in New Issue