【问题标题】:woocommerce-products-header in Subcategory - Remove Header Image子类别中的 woocommerce-products-header - 删除标题图像
【发布时间】:2017-10-03 15:19:32
【问题描述】:

我已经四处搜索,但似乎无法找到我正在寻找的确切内容。我在我的商店中设置了子类别,并为这些子类别分配了图像,因为我希望在您单击主类别 时显示缩略图。

但是,当我随后点击进入子类别页面以显示该子类别中的产品时,我为缩略图设置的图像出现在描述下方,非常大。

我不想要产品列表页面上的子类别图片。 woocommerce代码中有什么我可以更改或添加以实现这一点的吗?这就是它现在的样子...我希望它看起来像这样

提前致谢!

【问题讨论】:

  • 使用 CSS,您可以删除带有 { display:none; } 的照片。使用网络检查器发布该图像的 HTML,我会给你正确的选择器。
  • 啊!完美,非常感谢!
  • 你用什么 CSS 来隐藏图片?
  • 我使用了“woocommerce-layout.css”文件,并将codeimg{height:auto;max-width:100%;}code 更改为codeimg{height:自动;最大宽度:100%;显示:无;}code
  • 没有删除所有图片?

标签: php css wordpress woocommerce


【解决方案1】:

使用functions.php:

remove_action( 'woocommerce_before_subcategory_title', 'woocommerce_subcategory_thumbnail', 10 );
add_action( 'woocommerce_before_subcategory_title', 'custom_subcategory_thumbnail', 10 );
function custom_subcategory_thumbnail( $category ) {
    if ( $category->parent == '0' ) {
        woocommerce_subcategory_thumbnail( $category );
    } else {
        // do not show a category image
    }
}

使用 CSS:

.tax-product_cat ul.products li.product a img {
  display:none
}

注意:这个代码是在here找到的。

【讨论】:

  • 嗨,不幸的是,这只是删除了我想保留的主类别页面上的子类别缩略图!我想从显示产品的子类别“登陆页面”中删除大图像。我已经从那个链接看到了那个答案
猜你喜欢
  • 2019-12-25
  • 2019-05-15
  • 2021-12-27
  • 1970-01-01
  • 2014-12-23
  • 1970-01-01
  • 2021-08-11
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多