【问题标题】:Hide title in Woocommerce product category page在 Woocommerce 产品类别页面中隐藏标题
【发布时间】:2019-06-23 07:32:51
【问题描述】:

也许这对你来说太容易了,但对我来说……我做不到!伙计们,我需要在 Woocommerce 的 2 个产品类别页面中隐藏标题。 product-category/cat1(类别 id 145)和 product-category/cat2(类别 id 146)

我尝试使用 CSS 来实现:

.catid-145 .entry-title  {
visibility: hidden;
}

.category-145 .entry-title  {
visibility: hidden;
}

我知道这个标题是由:

<h1 class="entry-title">Title here</h1>

我需要删除标题文本并保留空格,这就是我使用“隐藏”的原因。 任何想法都将受到高度赞赏。谢谢。

【问题讨论】:

    标签: wordpress woocommerce hide title categories


    【解决方案1】:

    请试试这个:

    .catid-145 h1.entry-title {
        display: none;
    }
    

    【讨论】:

    • 我试过我的朋友。但什么也没有发生。谢谢你:)
    【解决方案2】:

    添加以下代码将从产品类别页面中删除页面标题:

    if(is_product_category())
    {
        add_filter( 'woocommerce_show_page_title', '__return_false' );  
    }
    

    请直接在functions.php中添加代码查看。希望这会对你有所帮助。

    【讨论】:

    • 不,我的朋友,什么都没有发生。无论如何,谢谢 :) 但我只需要删除 2 个类别的标题。谢谢你:)
    • 甚至可以使用 is_product_category(array('a-category','b-category');
    【解决方案3】:

    搜索如何从 WooCommerce 侧边栏中隐藏特定类别,此代码将为您提供帮助。

    转到产品> 类别> 单击要删除的类别上的编辑。 打开类别页面后,您可以在 url 中找到类别 ID,复制该 ID。 WooCommerce 从侧面隐藏类别 然后在外观>主题编辑器下打开functions.php文件。 只需将以下代码粘贴到最后,请将类别 id(斜体)替换为您的类别 id。

    add_filter( ‘woocommerce_product_categories_widget_args’, ‘woo_product_cat_widget_args’ );
    
    function woo_product_cat_widget_args( $cat_args ) {
        $cat_args[‘exclude’] = array(‘1725’,’1721′,’1719′,’1722′,’1723′,’1724′,’1725′,’1726′);
        return $cat_args;
    }
    

    https://phpfresh.com/hide-categories-from-woocommerce-sidebar/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-11-28
      • 1970-01-01
      • 2021-09-16
      • 1970-01-01
      • 2022-01-12
      • 2018-04-23
      • 2015-10-07
      相关资源
      最近更新 更多