'WooCommerce', 'id' => 'woocommerce', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'fasto_shop_widgets_init' ); /* ================================================================================================================= fasto_woo_enqueue_styles() - Enquque the new woocommerce css files ================================================================================================================= */ function fasto_woo_enqueue_styles(){ wp_enqueue_style( 'woocommerce-fasto', FASTO_URI.'/css/woocommerce.css' ); } add_action( 'wp_enqueue_scripts' , 'fasto_woo_enqueue_styles', 11 ); //product title function fasto_woo_loop_product_title() { echo '

'.esc_html( get_the_title() ).'

'; } add_action('woocommerce_shop_loop_item_title', 'fasto_woo_loop_product_title', 10); //shop breadcrumb function fasto_shop_breadcrumb() { return array( 'delimiter' => '  »  ', 'wrap_before' => '', 'before' => '
  • ', 'after' => '
  • ', 'home' => 'Home', ); } add_filter( 'woocommerce_breadcrumb_defaults', 'fasto_shop_breadcrumb' ); add_action( 'woocommerce_single_product_summary', 'woocommerce_breadcrumb', 1,1 ); add_action( 'woocommerce_archive_description', 'woocommerce_breadcrumb', 1,1 ); //removed actions remove_action( 'woocommerce_before_main_content','woocommerce_breadcrumb', 20, 0); remove_action( 'woocommerce_sidebar','woocommerce_get_sidebar'); remove_action('woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10); //sidebar grids if ( get_theme_mod('shop-layout') == 'grid-2-sidebar' || get_theme_mod('shop-layout') == 'grid-3-sidebar' ){ function fasto_before_shop_loop(){ echo '
    '; echo '
    '; echo ''; } add_action( 'woocommerce_before_shop_loop', 'fasto_before_shop_loop', 1,1 ); function fasto_after_shop_loop(){ echo '
    '; get_template_part( 'templates/woo-sidebar' ); echo '
    '; } add_action( 'woocommerce_after_shop_loop', 'fasto_after_shop_loop', 1,1 ); } //full grids if ( get_theme_mod('shop-layout') == 'grid-4' || get_theme_mod('shop-layout') == 'grid-3' ){ function fasto_before_shop_loop(){ echo '
    '; echo ''; } add_action( 'woocommerce_before_shop_loop', 'fasto_before_shop_loop', 1,1 ); } /* ================================================================================================================= fasto_shop_sale_text() - Sale text ================================================================================================================= */ function fasto_shop_sale_text( $text, $post, $_product ){ return '
    '.esc_attr__('Sale','fasto').'
    '; } add_filter('woocommerce_sale_flash', 'fasto_shop_sale_text', 10, 3); /* ================================================================================================================= fasto_shop_comment_args() - Review form ================================================================================================================= */ function fasto_shop_comment_args( $comment_form ){ $commenter = wp_get_current_commenter(); $name_email_required = (bool) get_option( 'require_name_email', 1 ); $required = $name_email_required ? ' required' : ''; $comment_form['comment_notes_before'] = '

    ' . esc_html__( 'Your email address will not be published.','fasto' ) . '

    '; $comment_form['title_reply_before'] = '

    '; $comment_form['title_reply_after'] = '

    '; $comment_form['fields']['author'] = '
    '; $comment_form['fields']['email'] = '
    '; $comment_form['fields']['cookies'] = ''; if ( wc_review_ratings_enabled() ) { $comment_form['comment_field'] = '
    '; } $comment_form['comment_field'] .= '

    '; return $comment_form; } add_filter('woocommerce_product_review_comment_form_args','fasto_shop_comment_args'); /* ================================================================================================================= fasto_loop_columns() - Change number or products per row ================================================================================================================= */ add_filter('loop_shop_columns', 'fasto_loop_columns', 999); function fasto_loop_columns() { if ( get_theme_mod('shop-layout') == 'grid-4' ){ return 4; } elseif ( get_theme_mod('shop-layout') == 'grid-3' ){ return 3; } elseif ( get_theme_mod('shop-layout') == 'grid-2-sidebar' ){ return 2; } elseif ( get_theme_mod('shop-layout') == 'grid-3-sidebar' ){ return 3; } } /* ================================================================================================================= fasto_append_cart_icon() - Append cart item (and cart count) to end of main menu. ================================================================================================================= */ add_filter( 'wp_nav_menu_items', 'fasto_append_cart_icon', 10, 2 ); function fasto_append_cart_icon( $items, $args ) { $cart_item_count = WC()->cart->get_cart_contents_count(); $cart_count_span = ''; if ( $cart_item_count ) { $cart_count_span = ''.$cart_item_count.''; } $cart_link = '
  • '.fasto_brands_svg('cart', false).''.$cart_count_span.'
  • '; # fasto_brands_svg() - safely escaped in functions/theme.php // Add the cart link to the end of the menu. $items = $items . $cart_link; return $items; } /* ================================================================================================================= fasto_loop_shop_per_page() - Change number of products that are displayed per page (shop page) ================================================================================================================= */ add_filter( 'loop_shop_per_page', 'fasto_loop_shop_per_page', 20 ); function fasto_loop_shop_per_page( $cols ) { $cols = !empty ( get_theme_mod( 'shop-per-page' ) ) ? get_theme_mod( 'shop-per-page' ) : 3; return $cols; }