Wordpress 删除 Storefront 主题的购物车

1. 修改PHP,找到 theme 下functions.php文件,添加以下代码

  1. Log into your WordPress site and access the Dashboard as the admin user.
  2. From the Dashboard menu, click on Appearance Menu > Theme Editor Menu. When the Theme Editor page is opened, look for the theme functions file where we will add the function that will disable the cart icon in the storefront theme.
  3. Add the following code to the php file:
/**

 * Disable Cart Icon

  */

function remove_sf_actions() {

    remove_action( 'storefront_header', 'storefront_header_cart', 60 );

}

add_action( 'init', 'remove_sf_actions' );

 

2. 修改CSS

检查元素定位到购物车,将display属性改为none, 并将下列代码粘贴到 Additional CSS中。

 

.site-header-cart .cart-contents {
    padding: 1.618em 0;
    display: none;
    position: relative;
    background-color: rgba(0,0,0,0);
    height: auto;
    width: auto;
    text-indent: 0;
}

 

 

Adding the Rule

The remaining part is to copy/paste into the “Additional CSS” section of your Storefront theme customization interface. To do this:

  • Log into your WordPress site and access the Dashboard as the admin user.
  • From the Dashboard menu, click on Appearance Menu > Customize.
  • Navigate down to Additional CSS in the left sidebar that appears.

 

posted @ 2021-03-08 22:24  Orchidelle  阅读(234)  评论(0编辑  收藏  举报