0

Storefront テーマのヘッダー ミニ カートのテキストを編集したいと思います: 'X items' を 'X' http://demo.woothemes.com/storefront/

これにはどこからアクセスできますか? 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 に答える