如何移除woocommerce的tabs【wordpress技巧】

  我们在用woocommerce建站时有时不想让产品的review显示出来,以使单个产品页面简单而令人印象深刻,那么要如何移除tab呢?可以在主题的function.php文件定义移除tabs函数,代码如下

add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
function woo_remove_product_tabs( $tabs ) {
    unset( $tabs['description'] );      	// Remove the description tab 移除产品描述
    unset( $tabs['reviews'] ); 			// Remove the reviews tab 移除评论
    unset( $tabs['additional_information'] );  	// Remove the additional information tab 移除更多信息
    return $tabs;
}

  不过需要注意的是,有网友留言说Warning: this removes the tab. But it also removes the content.移除tab标签,也可能移除内容。ytkah还没出现这个问题,建议大家修改前先做好备份!!!

posted @ 2019-06-25 09:32  ytkah  阅读(568)  评论(0编辑  收藏  举报
IPO发家故事 网址导航 gg N / G Sitemap

部分内容来源于网络,如有版权问题请联系删除