仅在Woocommerce单一产品中的“精选”产品的自定义标签中显示

时间:2018-09-08 00:41:58

标签: php sql wordpress woocommerce shortcode

我正在尝试将自定义标签设置为仅在我的“精选”产品上显示在产品页面上。 到目前为止,我已经成功地将自定义标签添加到了全球产品中,但是我未能仅将其添加到精选产品中。到目前为止,我的代码:

add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
    global $product;

    if ($product->is_featured()) {
        $tabs['test_tab'] = array(
            'title'     => __( 'Custom Tab"', 'woocommerce' ),
            'priority'  => 100,
            'callback'  => 'woo_new_product_tab_content'
        );
    }

    return $tabs;
}

function woo_new_product_tab_content() {
    echo '<p>Content for new custom tab.</p>';
}

如何在单个产品页面的此自定义产品标签中显示特色产品

0 个答案:

没有答案