如何隐藏WooCommerce Shop Page页面的标题

  有时我们不想显示WooCommerce Shop Page页面标题,如下图所示,需要如何操作呢?随ytkah一起来看看吧。在主题function.php文件中添加下面的代码就可以隐藏了

add_filter( 'woocommerce_show_page_title', 'bbloomer_hide_shop_page_title' );
 
function bbloomer_hide_shop_page_title( $title ) {
   if ( is_shop() ) $title = false;
   return $title;
}

  如果想隐藏产品分类页的标题呢?同样道理

add_filter( 'woocommerce_show_page_title', 'bbloomer_hide_cat_page_title' );
 
function bbloomer_hide_cat_page_title( $title ) {
   if ( is_product_category() ) $title = false;
   return $title;
}

  如果想隐藏shop、category、tag等页面的标题呢?

add_filter( 'woocommerce_show_page_title', '__return_null' );

  参考资料https://businessbloomer.com/woocommerce-remove-shop-title-woocommerce-shop-page/

原文地址:https://www.cnblogs.com/ytkah/p/12022720.html