';
echo '
';
}
}
if ( ! function_exists( 'blogbaster_woocommerce_wrapper_end' ) ) {
function blogbaster_woocommerce_wrapper_end() {
echo '';
echo '
';
/* Get Sidebar #secondary */
get_sidebar();
echo '
';
echo '';
}
}
/**
*
* Remove actions
* Remove product title when selected overlay header mode
*
*/
if( get_theme_mod('single_header_display') == 'alt' ) {
remove_action(
'woocommerce_single_product_summary',
'woocommerce_template_single_title', 5 );
}
/**
* Change the markup the woocommerce pagination by default
*/
function blogbaster_woo_pagination( $args ) {
$args['prev_text'] = __('Previous','blogbaster');
$args['next_text'] = __('Next','blogbaster');
$args['type'] = 'plain';
return $args;
}
add_filter( 'woocommerce_pagination_args', 'blogbaster_woo_pagination' );
/**
* Change the layout before each item product listing
*/
function blogbaster_before_shop_loop_item_title() {
echo '';
}
add_action (
'woocommerce_before_shop_loop_item_title',
'blogbaster_before_shop_loop_item_title' );
/**
* Change the layout after each item product listing
*/
function blogbaster_after_shop_loop_item() {
echo '
';
}
add_action (
'woocommerce_after_shop_loop_item',
'blogbaster_after_shop_loop_item' );
/**
* A form classes change function
*
* Modify each individual input type $args defaults
* Author: Adriano Monecchi http://stackoverflow.com/a/36724593/307826
*
* @param string $args Form attributes.
* @param string $key Not in use.
* @param null $value Not in use.
*
* @return mixed
*/
add_filter(
'woocommerce_form_field_args',
'blogbaster_wc_form_field_args', 10, 3
);
if ( ! function_exists( 'blogbaster_wc_form_field_args' ) ) {
function blogbaster_wc_form_field_args( $args, $key, $value = null ) {
// Start field type switch case.
switch ( $args['type'] ) {
/* Targets all select input type elements, except the country and state select input types */
case 'select':
// Add a class to the field's html element wrapper - woocommerce
// input types (fields) are often wrapped within a tag.
$args['class'][] = 'form-group';
// Add a class to the form input itself.
$args['input_class'] = array( 'form-control', '' );
$args['label_class'] = array( 'control-label' );
//$args['custom_attributes']['data-plugin'] = 'select2';
$args['custom_attributes'] = array(
'data-plugin' => 'select2',
'data-allow-clear' => 'true',
'aria-hidden' => 'true',
// Add custom data attributes to the form input itself.
);
break;
// By default WooCommerce will populate a select with the country names - $args
// defined for this specific input type targets only the country select element.
case 'country':
$args['class'][] = 'form-group single-country';
$args['label_class'] = array( 'control-label' );
break;
// By default WooCommerce will populate a select with state names - $args defined
// for this specific input type targets only the country select element.
case 'state':
// Add class to the field's html element wrapper.
$args['class'][] = 'form-group';
// add class to the form input itself.
$args['input_class'] = array( '', '' );
$args['label_class'] = array( 'control-label' );
//$args['custom_attributes']['data-plugin'] = 'select2';
$args['custom_attributes'] = array(
'data-plugin' => 'select2',
'data-allow-clear' => 'true',
'aria-hidden' => 'true',
);
break;
case 'password':
case 'text':
case 'email':
case 'tel':
case 'number':
$args['class'][] = 'form-group';
$args['input_class'] = array( 'form-control', '' );
$args['label_class'] = array( 'control-label' );
break;
case 'textarea':
$args['input_class'] = array( 'form-control', '' );
//$args['label_class'] = array( 'control-label' );
break;
case 'checkbox':
$args['label_class'] = array( 'form-check-label' );
$args['input_class'] = array( 'form-check-input', '' );
break;
case 'radio':
$args['label_class'] = array( 'form-check-input' );
$args['input_class'] = array( 'form-check-label', '' );
break;
default:
$args['class'][] = 'form-group';
$args['input_class'] = array( 'form-control', '' );
//$args['label_class'] = array( 'control-label' );
break;
} // end switch ($args).
return $args;
}
}
/**
* Change the markup the count category
*/
function blogbaster_count_category_html( $html, $category ){
$html = ' ' . esc_html( $category->count ) . '';
return $html;
}
add_filter( 'woocommerce_subcategory_count_html', 'blogbaster_count_category_html', 10, 2 );
/**
* Change the markup the sale badge
*/
function blogbaster_sale_badge_html($content, $post, $product){
$html = ''.__( 'Sale', 'blogbaster' ).'';
return $html;
}
add_filter('woocommerce_sale_flash', 'blogbaster_sale_badge_html', 10, 3);