その機能は関数によって処理され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 は親テーマよりも先に読み込まれるため、関数を最初に存在させます。