简体   繁体   English

如何删除 Woocommerce 商店页面上的简短描述

[英]How can I remove short description on the shop page in Woocommerce

Shortly, I want to just remove the short description on the shop/archive page.很快,我想删除商店/存档页面上的简短描述。 I added two images.我添加了两张图片。 it will be helpful for your understanding.这将有助于您的理解。 I tried many combination but not working on shop page.我尝试了很多组合,但没有在商店页面上工作。

I found a code but it was just removed on the product page.我找到了一个代码,但它刚刚在产品页面上被删除。

remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );

function woocommerce_template_single_excerpt() {
        return;
}

在此处输入图像描述

在此处输入图像描述

Option 1 : To remove description entirely place the following action in your child theme functions.php选项 1 :要完全删除描述,请将以下操作放在您的子主题功能中。php

remove_action('woocommerce_after_shop_loop_item_title','electro_template_loop_product_excerpt', 80 );

Option 2 : To override the function place the following function in your child theme functions.php file选项 2 :要覆盖 function 将以下 function 放在您的子主题 functions.php 文件中

function electro_template_loop_product_excerpt() {
    global $post;
    // In case you want to limit description for example or output different content there
    if ( ! is_object( $post ) || ! $post->post_excerpt || $post->post_excerpt ) {
        return;
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM