'; } add_action('woocommerce_archive_description', 'before_archive_description', 1); add_action('woocommerce_before_shop_loop', 'before_archive_description', 1); function after_archive_description() { echo ''; } add_action('woocommerce_archive_description', 'after_archive_description', 40); add_action('woocommerce_before_shop_loop', 'after_archive_description', 40); function clearfix_append() { echo '
'; } // 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 } } } /** * WooCommerce cart button */ /** * These functions will add WooCmmerce or Easy Digital Downloads cart icons/menu items to the "top_nav" WordPress menu area (if it exists). * Please customize the following code to fit your needs. */ /** * This function adds the WooCommerce or Easy Digital Downloads cart icons/items to the top_nav menu area as the last item. */ add_filter('wp_nav_menu_items', 'my_wp_nav_menu_items', 10, 2); function my_wp_nav_menu_items($items, $args, $ajax = false) { // Top Navigation Area Only if ((isset($ajax) && $ajax) || (property_exists($args, 'theme_location') && $args->theme_location === 'main_menu')) { $minicart = get_minicart_template_as_variable(); //Initialize string variable $drop_down = ''; // Get theme options $cart_in_menu = get_theme_mod('smartlib_display_cart_button_in_menu', '1'); $mini_cart = get_theme_mod('smartlib_display_mini_cart_in_menu', '1'); if (class_exists('woocommerce') && ($cart_in_menu == '1')) { $css_class = 'menu-item menu-item-type-cart menu-item-type-woocommerce-cart '; if ($mini_cart == '1') { $drop_down = 'data-toggle="dropdown"'; } // Is this the cart page? if (is_cart()) $css_class .= ' current-menu-item'; $items .= '
  • '; $items .= '  '; $items .= wp_kses_data(WC()->cart->get_cart_total()) . '  ' . WC()->cart->get_cart_contents_count() . ''; if ($mini_cart == '1') { $items .= ''; } $items .= '
  • '; } // Easy Digital Downloads else if (class_exists('Easy_Digital_Downloads')) { $css_class = 'menu-item menu-item-type-cart menu-item-type-edd-cart'; // Is this the cart page? if (edd_is_checkout()) $css_class .= ' current-menu-item'; $items .= '
  • '; $items .= '  '; $items .= wp_kses_data(edd_cart_subtotal()) . '  ' . edd_get_cart_quantity() . ''; if ($mini_cart == '1') { $items .= ''; } $items .= '
  • '; } } return $items; } /** * This function updates the Top Navigation WooCommerce cart link contents when an item is added via AJAX. */ add_filter('woocommerce_add_to_cart_fragments', 'my_woocommerce_add_to_cart_fragments'); function my_woocommerce_add_to_cart_fragments($fragments) { // Add our fragment $fragments['li.menu-item-type-woocommerce-cart'] = my_wp_nav_menu_items('', new stdClass(), true); return $fragments; } /** * * Return minicart snippet as variable * @return string */ function get_minicart_template_as_variable() { global $args; if (function_exists('wc_get_template')) { ob_start(); woocommerce_mini_cart(); $minicart = ob_get_contents(); ob_end_clean(); return $minicart; } } /** * Adding Bootstrap Forms to WooCommerce */ add_filter('woocommerce_form_field_args', 'wc_form_field_args', 10, 3); function wc_form_field_args($args, $key, $value) { $args['input_class'] = array('form-control'); return $args; }