150, 'single_image_width' => 300, 'product_grid' => array( 'default_rows' => 3, 'min_rows' => 1, 'default_columns' => 4, 'min_columns' => 1, 'max_columns' => 6, ), ) ); add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); } add_action( 'after_setup_theme', 'brighter_blog_woocommerce_setup' ); /** * Products per row. */ function brighter_blog_woocommerce_loop_columns() { return 3; } add_filter( 'loop_shop_columns', 'brighter_blog_woocommerce_loop_columns' ); /** * Enqueue WooCommerce styles. */ function brighter_blog_woocommerce_scripts() { wp_enqueue_style( 'brighter-blog-woocommerce-style', get_template_directory_uri() . '/woocommerce.css', array(), defined( 'BRIGHTER_BLOG_VERSION' ) ? BRIGHTER_BLOG_VERSION : wp_get_theme()->get( 'Version' ) ); // WC star font (rating) if ( function_exists( 'WC' ) ) { $font_path = WC()->plugin_url() . '/assets/fonts/'; $inline_font = '@font-face { font-family: "star"; src: url("' . esc_url( $font_path . 'star.eot' ) . '"); src: url("' . esc_url( $font_path . 'star.eot?#iefix' ) . '") format("embedded-opentype"), url("' . esc_url( $font_path . 'star.woff' ) . '") format("woff"), url("' . esc_url( $font_path . 'star.ttf' ) . '") format("truetype"), url("' . esc_url( $font_path . 'star.svg#star' ) . '") format("svg"); font-weight: normal; font-style: normal; }'; wp_add_inline_style( 'brighter-blog-woocommerce-style', $inline_font ); } } add_action( 'wp_enqueue_scripts', 'brighter_blog_woocommerce_scripts' ); /** * Disable default WooCommerce styles. */ add_filter( 'woocommerce_enqueue_styles', '__return_empty_array' ); /** * Body class. */ function brighter_blog_woocommerce_active_body_class( $classes ) { $classes[] = 'woocommerce-active'; return $classes; } add_filter( 'body_class', 'brighter_blog_woocommerce_active_body_class' ); /** * Related products args. */ function brighter_blog_woocommerce_related_products_args( $args ) { return wp_parse_args( array( 'posts_per_page' => 3, 'columns' => 3, ), $args ); } add_filter( 'woocommerce_output_related_products_args', 'brighter_blog_woocommerce_related_products_args' ); /** * Remove default breadcrumb. */ add_action( 'init', function () { remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 ); } ); /** * Replace WooCommerce content wrappers. */ remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 ); remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 ); function brighter_blog_woocommerce_wrapper_before() { echo '
'; } add_action( 'woocommerce_before_main_content', 'brighter_blog_woocommerce_wrapper_before' ); function brighter_blog_woocommerce_wrapper_after() { echo '
'; } add_action( 'woocommerce_after_main_content', 'brighter_blog_woocommerce_wrapper_after' ); /** * Cart fragments (AJAX update). */ function brighter_blog_woocommerce_cart_link_fragment( $fragments ) { if ( ! WC()->cart ) { return $fragments; } ob_start(); brighter_blog_woocommerce_cart_link(); $fragments['a.cart-contents'] = ob_get_clean(); return $fragments; } add_filter( 'woocommerce_add_to_cart_fragments', 'brighter_blog_woocommerce_cart_link_fragment' ); /** * Cart link. */ function brighter_blog_woocommerce_cart_link() { if ( ! WC()->cart ) { return; } ?> cart->get_cart_subtotal() ); ?> cart->get_cart_contents_count(), 'brighter-blog' ) ), (int) WC()->cart->get_cart_contents_count() ); ?>