/**
  * This function adds the WooCommerce or Easy Digital Downloads cart icons/items to the top_nav
  * menu area as the last item.
  */
 function wp_nav_menu_items($items, $args, $ajax = false)
 {
     // Top Navigation area only
     if (isset($ajax) && $ajax || property_exists($args, 'theme_location') && $args->theme_location === 'top_nav') {
         // WooCommerce
         if (class_exists('woocommerce')) {
             $css_class = 'menu-item menu-item-type-cart menu-item-type-woocommerce-cart';
             // Is this the cart page?
             if (is_cart()) {
                 $css_class .= ' current-menu-item';
             }
             $items .= '<li class="' . esc_attr($css_class) . '">';
             $items .= '<a class="cart-contents" href="' . esc_url(WC()->cart->get_cart_url()) . '">';
             $items .= wp_kses_data(WC()->cart->get_cart_total()) . ' - <span class="count">' . wp_kses_data(sprintf(_n('%d item', '%d items', WC()->cart->get_cart_contents_count(), 'simple-shop'), WC()->cart->get_cart_contents_count())) . '</span>';
             $items .= '</a>';
             $items .= '</li>';
         } 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 .= '<li class="' . esc_attr($css_class) . '">';
                 $items .= '<a class="cart-contents" href="' . esc_url(edd_get_checkout_uri()) . '">';
                 $items .= wp_kses_data(edd_cart_subtotal()) . ' - <span class="count">' . wp_kses_data(sprintf(_n('%d item', '%d items', edd_get_cart_quantity(), 'simple-shop'), edd_get_cart_quantity())) . '</span>';
                 $items .= '</a>';
                 $items .= '</li>';
             }
         }
     }
     return $items;
 }
예제 #2
0
        echo ' style="display:none;"';
    }
    ?>
>
				<?php 
    do_action('edd_checkout_table_subtotal_first');
    ?>
				<th colspan="<?php 
    echo edd_checkout_cart_columns();
    ?>
" class="edd_cart_subtotal">
					<?php 
    esc_html_e('Subtotal', 'helium');
    ?>
:&nbsp;<span class="edd_cart_subtotal_amount"><?php 
    echo edd_cart_subtotal();
    ?>
</span>
				</th>
				<?php 
    do_action('edd_checkout_table_subtotal_last');
    ?>
			</tr>
		<?php 
}
?>
		
		<tr class="edd_cart_footer_row edd_cart_discount_row" <?php 
if (!edd_cart_has_discounts()) {
    echo ' style="display:none;"';
}
	</tbody>
	<tfoot>

		<?php if( has_action( 'edd_cart_footer_buttons' ) ) : ?>
			<tr class="edd_cart_footer_row<?php if ( edd_is_cart_saving_disabled() ) { echo ' edd-no-js'; } ?>">
				<th colspan="<?php echo edd_checkout_cart_columns(); ?>">
					<?php do_action( 'edd_cart_footer_buttons' ); ?>
				</th>
			</tr>
		<?php endif; ?>

		<?php if( edd_use_taxes() ) : ?>
			<tr class="edd_cart_footer_row edd_cart_subtotal_row"<?php if ( ! edd_is_cart_taxed() ) echo ' style="display:none;"'; ?>>
				<?php do_action( 'edd_checkout_table_subtotal_first' ); ?>
				<th colspan="<?php echo edd_checkout_cart_columns(); ?>" class="edd_cart_subtotal">
					<?php _e( 'Subtotal', 'edd' ); ?>:&nbsp;<span class="edd_cart_subtotal_amount"><?php echo edd_cart_subtotal(); ?></span>
				</th>
				<?php do_action( 'edd_checkout_table_subtotal_last' ); ?>
			</tr>
		<?php endif; ?>

		<tr class="edd_cart_footer_row edd_cart_discount_row" <?php if( ! edd_cart_has_discounts() )  echo ' style="display:none;"'; ?>>
			<?php do_action( 'edd_checkout_table_discount_first' ); ?>
			<th colspan="<?php echo edd_checkout_cart_columns(); ?>" class="edd_cart_discount">
				<?php edd_cart_discounts_html(); ?>
			</th>
			<?php do_action( 'edd_checkout_table_discount_last' ); ?>
		</tr>

		<?php if( edd_use_taxes() ) : ?>
			<tr class="edd_cart_footer_row edd_cart_tax_row"<?php if( ! edd_is_cart_taxed() ) echo ' style="display:none;"'; ?>>