plugin_url() . '/assets/fonts/'; $inline_font = '@font-face { font-family: "star"; src: url("' . $font_path . 'star.eot"); src: url("' . $font_path . 'star.eot?#iefix") format("embedded-opentype"), url("' . $font_path . 'star.woff") format("woff"), url("' . $font_path . 'star.ttf") format("truetype"), url("' . $font_path . 'star.svg#star") format("svg"); font-weight: normal; font-style: normal; }'; wp_add_inline_style( 'the-styled-blog-woocommerce-style', $inline_font ); } add_action( 'wp_enqueue_scripts', 'the_styled_blog_woocommerce_scripts' ); /** * Disable the default WooCommerce stylesheet. * * Removing the default WooCommerce stylesheet and enqueing your own will * protect you during WooCommerce core updates. * * @link https://docs.woocommerce.com/document/disable-the-default-stylesheet/ */ //add_filter( 'woocommerce_enqueue_styles', '__return_empty_array' ); /** * Add 'woocommerce-active' class to the body tag. * * @param array $classes CSS classes applied to the body tag. * @return array $classes modified to include 'woocommerce-active' class. */ function the_styled_blog_woocommerce_active_body_class( $classes ) { $classes[] = 'woocommerce-active'; return $classes; } add_filter( 'body_class', 'the_styled_blog_woocommerce_active_body_class' ); /** * Related Products Args. * * @param array $args related products args. * @return array $args related products args. */ function the_styled_blog_woocommerce_related_products_args( $args ) { $defaults = array( 'posts_per_page' => 3, 'columns' => 3, ); $args = wp_parse_args( $defaults, $args ); return $args; } add_filter( 'woocommerce_output_related_products_args', 'the_styled_blog_woocommerce_related_products_args' ); /** * Remove default WooCommerce wrapper. */ remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 ); remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 ); if ( ! function_exists( 'the_styled_blog_woocommerce_wrapper_before' ) ) { /** * Before Content. * * Wraps all WooCommerce content in wrappers which match the theme markup. * * @return void */ function the_styled_blog_woocommerce_wrapper_before() { ?>
*/ if ( ! function_exists( 'the_styled_blog_woocommerce_cart_link_fragment' ) ) { /** * Cart Fragments. * * Ensure cart contents update when products are added to the cart via AJAX. * * @param array $fragments Fragments to refresh via AJAX. * @return array Fragments to refresh via AJAX. */ function the_styled_blog_woocommerce_cart_link_fragment( $fragments ) { ob_start(); the_styled_blog_woocommerce_cart_link(); $fragments['a.cart-contents'] = ob_get_clean(); return $fragments; } } add_filter( 'woocommerce_add_to_cart_fragments', 'the_styled_blog_woocommerce_cart_link_fragment' ); if ( ! function_exists( 'the_styled_blog_woocommerce_cart_link' ) ) { /** * Cart Link. * * Displayed a link to the cart including the number of items present and the cart total. * * @return void */ function the_styled_blog_woocommerce_cart_link() { ?> cart->get_cart_contents_count(), 'the-styled-blog' ), WC()->cart->get_cart_contents_count() ); ?> cart->get_cart_subtotal() ); ?> '; echo '
'; } endif; add_action( 'woocommerce_before_single_product_summary', 'the_styled_blog_single_product_content_wrapper_open', 5 ); if( !function_exists( 'the_styled_blog_single_product_content_wrapper_close' ) ) : /** * Single product content wapper close * */ function the_styled_blog_single_product_content_wrapper_close() { echo '
'; echo '
'; } endif; add_action( 'woocommerce_after_single_product_summary', 'the_styled_blog_single_product_content_wrapper_close', 100 ); if( ! function_exists( 'the_styled_blog_single_product_image_wrap_open' ) ) : /** * Single product image wrap open * */ function the_styled_blog_single_product_image_wrap_open() { echo '
'; } endif; add_action( 'woocommerce_before_single_product_summary', 'the_styled_blog_single_product_image_wrap_open', 5 ); if( ! function_exists( 'the_styled_blog_single_product_image_wrap_close' ) ) : /** * Single product image wrap close * */ function the_styled_blog_single_product_image_wrap_close() { echo '
'; } endif; add_action( 'woocommerce_before_single_product_summary', 'the_styled_blog_single_product_image_wrap_close', 50 ); if( ! function_exists( 'the_styled_blog_single_product_summary_wrap_open' ) ) : /** * Single product summary wrap open * */ function the_styled_blog_single_product_summary_wrap_open() { echo '
'; echo '
'; } endif; add_action( 'woocommerce_before_single_product_summary', 'the_styled_blog_single_product_summary_wrap_open', 50 ); if( ! function_exists( 'the_styled_blog_single_product_summary_wrap_close' ) ) : /** * Single product summary wrap open * */ function the_styled_blog_single_product_summary_wrap_close() { echo '
'; echo '
'; } endif; add_action( 'woocommerce_after_single_product_summary', 'the_styled_blog_single_product_summary_wrap_close', 5 ); if( ! function_exists( 'the_styled_blog_single_product_footer_wrap_open' ) ) : /** * Single product footer wrap open * */ function the_styled_blog_single_product_footer_wrap_open() { echo '
'; } endif; if( ! function_exists( 'the_styled_blog_single_product_footer_wrap_close' ) ) : /** * Single product footer wrap close * */ function the_styled_blog_single_product_footer_wrap_close() { echo '
'; } endif; add_action( 'woocommerce_after_single_product_summary', 'the_styled_blog_single_product_footer_wrap_open', 9 ); add_action( 'woocommerce_after_single_product_summary', 'the_styled_blog_single_product_footer_wrap_close', 50 ); if( ! function_exists( 'the_styled_blog_single_product_summary_top_meta_open' ) ) : /** * Single product summary top meta open * */ function the_styled_blog_single_product_summary_top_meta_open() { echo '
'; } endif; if( ! function_exists( 'the_styled_blog_single_product_summary_top_meta_close' ) ) : /** * Single product summary top meta close * */ function the_styled_blog_single_product_summary_top_meta_close() { echo '
'; } endif; add_action( 'woocommerce_single_product_summary', 'the_styled_blog_single_product_summary_top_meta_open', 4 ); add_action( 'woocommerce_single_product_summary', 'the_styled_blog_single_product_summary_top_meta_close', 35 ); if( ! function_exists( 'the_styled_blog_single_product_summary_bottom_meta_open' ) ) : /** * Single product summary bottom meta open * */ function the_styled_blog_single_product_summary_bottom_meta_open() { echo '
'; } endif; if( ! function_exists( 'the_styled_blog_single_product_summary_bottom_meta_close' ) ) : /** * Single product summary bottom meta close * */ function the_styled_blog_single_product_summary_bottom_meta_close() { echo '
'; } endif; add_action( 'woocommerce_single_product_summary', 'the_styled_blog_single_product_summary_bottom_meta_open', 36 ); add_action( 'woocommerce_single_product_summary', 'the_styled_blog_single_product_summary_bottom_meta_close', 70 ); if( ! function_exists( 'the_styled_blog_product_loop_content_wrap_open' ) ) : /** * Product loop content wrap open * */ function the_styled_blog_product_loop_content_wrap_open() { echo '
'; } endif; if( ! function_exists( 'the_styled_blog_product_loop_content_wrap_close' ) ) : /** * Product loop content wrap close * */ function the_styled_blog_product_loop_content_wrap_close() { echo '
'; } endif; add_action( 'woocommerce_shop_loop_item_title', 'the_styled_blog_product_loop_content_wrap_open', 5 ); add_action( 'woocommerce_after_shop_loop_item_title', 'the_styled_blog_product_loop_content_wrap_close', 15 ); if( ! function_exists( 'the_styled_blog_product_loop_content_left_wrap_open' ) ) : /** * Product loop content left wrap open * */ function the_styled_blog_product_loop_content_left_wrap_open() { echo '
'; } endif; if( ! function_exists( 'the_styled_blog_product_loop_content_left_wrap_close' ) ) : /** * Product loop content left wrap close * */ function the_styled_blog_product_loop_content_left_wrap_close() { echo '
'; } endif; add_action( 'woocommerce_shop_loop_item_title', 'the_styled_blog_product_loop_content_left_wrap_open', 9 ); add_action( 'woocommerce_after_shop_loop_item_title', 'the_styled_blog_product_loop_content_left_wrap_close', 6 ); if( ! function_exists( 'the_styled_blog_product_loop_content_right_wrap_open' ) ) : /** * Product loop content right wrap open * */ function the_styled_blog_product_loop_content_right_wrap_open() { echo '
'; } endif; if( ! function_exists( 'the_styled_blog_product_loop_content_right_wrap_close' ) ) : /** * Product loop content right wrap close * */ function the_styled_blog_product_loop_content_right_wrap_close() { echo '
'; } endif; add_action( 'woocommerce_after_shop_loop_item_title', 'the_styled_blog_product_loop_content_right_wrap_open', 9 ); add_action( 'woocommerce_after_shop_loop_item_title', 'the_styled_blog_product_loop_content_right_wrap_close', 11 );