小编Shi*_*sky的帖子

删除 WooCommerce 评论选项卡上的 (0)

当没有评论时,我成功地删除了评论选项卡标题上的 (0)。在营销中 - 最好的做法是不显示产品有 0 条评论。这是我放置在我的子主题的 functions.php 文件中的代码,该文件位于 WooCommerce 插件文件 wc-template-function.php 中:

if ( ! function_exists( 'woocommerce_default_product_tabs' ) ) {

/**
 * Add default product tabs to product pages.
 *
 * @param array $tabs
 * @return array
 */
function woocommerce_default_product_tabs( $tabs = array() ) {
    global $product, $post;

    // Description tab - shows product content
    if ( $post->post_content ) {
        $tabs['description'] = array(
            'title'    => __( 'Description', 'woocommerce' ),
            'priority' => 10,
            'callback' => 'woocommerce_product_description_tab'
        );
    }

    // Additional information …
Run Code Online (Sandbox Code Playgroud)

php wordpress function review woocommerce

5
推荐指数
1
解决办法
4611
查看次数

标签 统计

function ×1

php ×1

review ×1

woocommerce ×1

wordpress ×1