子テーマのfunctions.phpファイルを介して親テーマからショッピングカートを削除しようとしています。私は簡単にそれを親のfunctions.phpから削除することができましたが、私たちは皆それがno-noであることを知っています。さらに、それを元に戻すオプションは将来利用可能になるはずです。残念ながら、親テーマMAXSTOREはカスタマイズされており、woocommerceからの一般的な削除は機能しません。 MAXSTOREの親で関数をハックする必要があります。しかし、私はこれで本当にうまくいきません。誰も私にこれを行う方法を示すことができますか?子テーマのfunctions.phpからメニューからショッピングカートを削除する
p.s.ウィッシュリストの部分を心配しないでください。ここで
が親のfunctions.phpから問題になっている機能
////////////////////////////////////////////////////////////////////
// WooCommerce header cart
////////////////////////////////////////////////////////////////////
if (!function_exists('maxstore_cart_link')) {
function maxstore_cart_link() {
?>
<a class="cart-contents text-right" href="<?php echo esc_url(WC()->cart->get_cart_url()); ?>" title="<?php _e('View your shopping cart', 'maxstore'); ?>">
<i class="fa fa-shopping-cart">
<span class="count"><?php echo WC()->cart->get_cart_contents_count(); ?></span>
</i>
<span class="amount-title hidden-sm hidden-xs"><?php echo _e('Cart ', 'maxstore'); ?></span>
<span class="amount-cart"><?php echo wp_kses_data(WC()->cart->get_cart_subtotal()); ?></span>
</a>
<?php
}
}
if (!function_exists('maxstore_head_wishlist')) {
function maxstore_head_wishlist() {
if (function_exists('YITH_WCWL')) {
$wishlist_url = YITH_WCWL()->get_wishlist_url();
?>
<div class="top-wishlist text-right">
<a href="<?php echo esc_url($wishlist_url); ?>" title="Wishlist" data-toggle="tooltip">
<i class="fa fa-heart"><div class="count"><span><?php echo yith_wcwl_count_products(); ?></span></div></i>
</a>
</div>
<?php
}
}
}
add_action('wp_ajax_yith_wcwl_update_single_product_list', 'maxstore_head_wishlist');
add_action('wp_ajax_nopriv_yith_wcwl_update_single_product_list', 'maxstore_head_wishlist');
if (!function_exists('maxstore_header_cart')) {
function maxstore_header_cart() {
?>
<div class="header-cart-inner">
<?php maxstore_cart_link(); ?>
<ul class="site-header-cart menu list-unstyled">
<li>
<?php the_widget('WC_Widget_Cart', 'title='); ?>
</li>
</ul>
</div>
<?php
if (get_theme_mod('wishlist-top-icon', 0) != 0) {
echo maxstore_head_wishlist();
}
?>
<?php
}
}
if (!function_exists('maxstore_header_add_to_cart_fragment')) {
add_filter('woocommerce_add_to_cart_fragments', 'maxstore_header_add_to_cart_fragment');
function maxstore_header_add_to_cart_fragment($fragments) {
ob_start();
maxstore_cart_link();
$fragments[ 'a.cart-contents' ] = ob_get_clean();
return $fragments;
}
}
////////////////////////////////////////////////////////////////////
EDIT
は、フロントエンド開発されている);テーマの設定は、その可視性を制御するための便利なダンディチェックボックスを持っていました私はCSSでそれをやっていました。良い解決策は、私はので、私は自分の質問に答えない頼まない私が欲しいものとないものを、代わりに私は他の人がそれ
li#wpmenucartli {
display: none; //hides the menu cart list item
}
.navbar-inverse .navbar-nav > li:nth-last-child(2) > a:after {
content: ''; //gets rid of the trailing dash on the second to last list item to pretend it is the actual last item
border-right:none; //if you have a border, this does the same as above
}
は、事前にありがとう検討するためにそれをここに投稿します
私はこの問題を完全に理解しているかどうかはわかりませんが、コード全体をコメントアウトできますか? –
私は本当に明確だと思った。私は実際にそれを実際によくしています。さて、ここには、私がコードをコメントアウトすると、テーマがアップデートを取得するとすぐに、それが戻ってくるでしょう。そのため、いつでもテーマを変更したい場合は、そのテーマを子テーマで行う必要があります。 ;) – LOTUSMS
心配はいりません。私はまだWordPressではあまり働いていないので、おそらく私のせいです。親コードは私が見ることができたので、私はそれを撃った。 :)多分誰かがもっと助けることができます。 –