小编Luk*_*ars的帖子

Woocommerce Storefront template-tags.php无法更改为storefront_cart_link()

我正在使用WordPress 4.3.1,Woocommerce 2.4.7和主题店面1.5.1.

我想更改标题中的"site-header-cart",它显示购物车的当前价格以及购物车中商品的数量,仅显示商品数量:

<span class="amount">463,33&nbsp;€</span>
<span class="count">7 items</span>
Run Code Online (Sandbox Code Playgroud)

应该:

<span class="count">7</span>
Run Code Online (Sandbox Code Playgroud)

每当我对template-tags.php进行更改时,只会更改

<a class="cart-contents" ...>
...
</a>
Run Code Online (Sandbox Code Playgroud)

正在展示.每当我尝试更改href内部的内容时,将显示未更改的原件:

if ( ! function_exists( 'storefront_cart_link' ) ) {
    function storefront_cart_link() {
        ?>
            <a class="cart-contents" href="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>" title="<?php _e( 'View your shopping cart', 'storefront' ); ?>">
                <span class="count"><?php echo wp_kses_data( sprintf( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count(), 'storefront' ), WC()->cart->get_cart_contents_count() ) );?></span>
            </a>
        <?php
    }
}
Run Code Online (Sandbox Code Playgroud)

怎么回事,谁能帮帮我?

php wordpress storefront woocommerce

4
推荐指数
1
解决办法
984
查看次数

标签 统计

php ×1

storefront ×1

woocommerce ×1

wordpress ×1