2016-05-21 63 views
0

目录页面与产品说明和简短说明的范围有很大的不同。这个关闭设置每个产品的不同,我希望每个产品在目录网格中占用更少的空间。因此,我想从产品目录页面中删除产品的说明,并且只在用户选择产品时在单一产品页面中显示。如果可能的话,我还希望搜索功能不包括来自产品简短描述的文字。任何建议将不胜感激。Woocommerce不在目录页面上显示产品说明,但仍显示在单个产品页面中

+1

这仍然是默认主题的情况吗?因为显示摘录的'woocommerce_template_single_excerpt()'不会被WooCommerce的'content-product.php'模板调用,该模板是归档循环默认显示的模板。意思是说,它可以通过你的主题添加。 – helgatheviking

+0

嗨,是的,据我所知它是默认的,但我运行各种插件和儿童主题模板(Templatemela)。我已经在所有选项中查找了几个小时,我可以很自信地说,从目录页面中删除描述是没有限制的。然而,我发现了一个解决方法,我从类似的问题中得到了这个想法,从单个产品页面中删除了简短的细节。编辑CSS文件:wp-content - > themes - > myTheme - > css - > woocommerce.css。添加以下代码:.product-block-inner> div [itemprop =“description”] { display:none; } – Shaun

+0

不,我的意思是一个默认的主题,如二十十六,因为据我可以告诉WooCommerce摘录不应该在那里。这里有一个[二十十六的截图](http://imagizer.imageshack.com/img923/1610/GiDr6n.jpg)我建议看看你的主题的'content-product.php'模板和/或搜索你的主题来看看如果'woocommerce_template_single_excerpt'被添加到某处的钩子。 – helgatheviking

回答

1
function filter_woocommerce_short_description($post_post_excerpt) { 
if(is_shop() || is_product_category()) { 
    return false; 
} else { 
    return $post_post_excerpt; 
}  
}; 
// add the filter 
add_filter('woocommerce_short_description', 'filter_woocommerce_short_description', 10, 1); 
相关问题