示例#1
0
 function woocommerce_cart_tab()
 {
     global $woocommerce;
     $skin = get_option('wc_ct_skin');
     $position = get_option('wc_ct_horizontal_position');
     $widget = get_option('wc_ct_cart_widget');
     $hide_widget = get_option('wc_ct_hide_empty_cart');
     if ($woocommerce->cart->get_cart_contents_count() == 0 && $hide_widget == 'yes') {
         // Hide empty cart
         // Compatible with WP Super Cache as long as "late init" is enabled
         $visibility = 'hidden';
     } else {
         $visibility = 'visible';
     }
     if (!is_cart() && !is_checkout()) {
         if ($widget == 'yes') {
             echo '<div class="' . esc_attr($position) . ' cart-tab ' . esc_attr($skin) . ' ' . esc_attr($visibility) . '">';
         } else {
             echo '<div class="' . esc_attr($position) . ' cart-tab no-animation ' . esc_attr($skin) . ' ' . esc_attr($visibility) . '">';
         }
         wcct_cart_button();
         // Display the widget if specified
         if ($widget == 'yes') {
             // Check for WooCommerce 2.0 and display the cart widget
             if (version_compare(WOOCOMMERCE_VERSION, "2.0.0") >= 0) {
                 the_widget('WC_Widget_Cart', 'title=');
             } else {
                 the_widget('WooCommerce_Widget_Cart', 'title=');
             }
         }
         echo '</div>';
     }
 }
示例#2
0
 function woocommerce_cart_tab()
 {
     global $woocommerce;
     $skin = get_option('wc_ct_skin');
     $position = get_option('wc_ct_horizontal_position');
     $widget = get_option('wc_ct_cart_widget');
     if (!is_cart() && !is_checkout()) {
         if ($widget == 'yes') {
             echo '<div class="' . $position . ' cart-tab ' . $skin . '">';
         } else {
             echo '<div class="' . $position . ' cart-tab no-animation ' . $skin . '">';
         }
         wcct_cart_button();
         // Display the widget if specified
         if ($widget == 'yes') {
             // Check for WooCommerce 2.0 and display the cart widget
             if (version_compare(WOOCOMMERCE_VERSION, "2.0.0") >= 0) {
                 the_widget('WC_Widget_Cart', 'title=');
             } else {
                 the_widget('WooCommerce_Widget_Cart', 'title=');
             }
         }
         echo '</div>';
     }
 }