Skip to content

Instantly share code, notes, and snippets.

@dajocarter
Last active June 26, 2017 15:16
Show Gist options
  • Save dajocarter/0ac3acaa1f6806de72fa7de98cd7fb12 to your computer and use it in GitHub Desktop.
Save dajocarter/0ac3acaa1f6806de72fa7de98cd7fb12 to your computer and use it in GitHub Desktop.
WooCommerce Adjustments. Throw these in the functions.php file of your theme.
add_filter( 'woocommerce_enqueue_styles', 'my_woocommerce_styles' );
function my_woocommerce_styles($styles){
unset($styles['woocommerce-layout']);
unset($styles['woocommerce-smallscreen']);
$styles['woocommerce-layout'] = array(
'src' => get_template_directory_uri() . '/css/woocommerce.css',
'deps' => '',
'version' => '1.0.0',
'media' => 'all'
);
return $styles;
}
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
add_action('woocommerce_after_main_content', 'uptown_wrapper_end', 10);
function uptown_wrapper_end() {
echo '</div>';
}
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
add_action('woocommerce_before_main_content', 'uptown_wrapper_start', 10);
function uptown_wrapper_start() {
echo '<div id="shop">';
}
add_filter( 'woocommerce_breadcrumb_defaults', 'jk_change_breadcrumb_delimiter' );
function jk_change_breadcrumb_delimiter( $defaults ) {
// Change the breadcrumb delimeter from '/' to '>'
$defaults['delimiter'] = ' &gt; ';
return $defaults;
}
add_action( 'after_setup_theme', 'woocommerce_support' );
function woocommerce_support() {
add_theme_support( 'woocommerce' );
}
// Change number or products per row to 3
add_filter('loop_shop_columns', 'loop_columns');
if (!function_exists('loop_columns')) {
function loop_columns() {
return 3; // 3 products per row
}
}
add_action( 'init', 'remove_wc_breadcrumbs' );
function remove_wc_breadcrumbs() {
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 );
}
function woocommerce_result_count() {
return false;
}
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment