0

我想将 Storefront 主题中标题迷你购物车中的文本编辑为:'X items' 为:'X' http://demo.woothemes.com/storefront/

我在哪里可以访问这个?在店面或 woocommerce 文件中的任何地方都找不到它。我可以在 header.php: storefront_header_cart 中看到钩子,但在其他文件中找不到任何函数?

当您将鼠标悬停在下拉列表上时,我也想删除它。我在哪里可以改变这个?

4

1 回答 1

2

该功能由storefront_cart_link功能处理......

你可以覆盖函数...打开functions.php...寻找require get_template_directory() . '/inc/init.php';

就在它上面,粘贴这段代码......

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' ); ?>">
                <?php echo wp_kses_data( WC()->cart->get_cart_subtotal() ); ?> <span class="count"><?php echo wp_kses_data( sprintf( '%d', WC()->cart->get_cart_contents_count() ) );?></span>
            </a>
        <?php
    }
}

storefront_cart_link加载了这个调用require get_template_directory() . '/inc/init.php';。所以上面将首先加载,使其不再通过调用创建该函数require get_template_directory() . '/inc/init.php';

这可以解决问题.. 但最好使用子主题... 您可以直接将上面的函数粘贴到子主题的functions.php 上。子主题上的functions.php 将比父主题先加载,因此使您的函数首先存在。

于 2016-02-17T03:50:32.630 回答