函数定义在includes
artificer主题的文件夹,位于theme-woocommerce.php
文件:
// Add the cart link to the header
add_action(\'woo_nav_before\', \'artificer_header_cart_link\', 20);
if ( ! function_exists( \'artificer_header_cart_link\' ) ) {
function artificer_header_cart_link() {
if ( class_exists( \'woocommerce\' ) ) { echo woocommerce_cart_link(); }
}
}
// Add the checkout link to the header
add_action(\'woo_nav_before\', \'artificer_header_checkout_link\',10);
if ( ! function_exists( \'artificer_header_checkout_link\' ) ) {
function artificer_header_checkout_link() {
global $woocommerce;
?>
<a href="<?php echo $woocommerce->cart->get_checkout_url()?>" class="checkout">
<span class="lozenge"><?php _e(\'Checkout\',\'woothemes\') ?></span>
</a>
<?php }
}
function woocommerce_cart_link() {
global $woocommerce;
?>
<a href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="<?php echo sprintf(_n(\'%d item\', \'%d items\', $woocommerce->cart->cart_contents_count, \'woothemes\'), $woocommerce->cart->cart_contents_count);?> <?php _e(\'in your shopping cart\', \'woothemes\'); ?>" class="cart-button ">
<span class="label"><?php _e(\'My Basket:\', \'woothemes\'); ?></span>
<?php echo $woocommerce->cart->get_cart_total(); ?>
<span class="items"><?php echo sprintf(_n(\'%d item\', \'%d items\', $woocommerce->cart->cart_contents_count, \'woothemes\'), $woocommerce->cart->cart_contents_count); ?></span>
</a>
<?php
}
edit:我意识到实际上还有一个语言文件,它会导致从我的图像中翻译“2项”文本。这些语言文件位于
lang 文件夹
我以前没有注意到这一点,直到我使用CodeStyling Localisation plugin.
然而,我无法翻译“我的篮子”,所以我在theme-woocommerce.php
手动归档。