合并WooCommerce产品描述和其他信息选项卡,最后显示描述

时间:2020-08-18 15:38:19

标签: php wordpress woocommerce tabs product

我想询问有关此主题的其他信息: How can I merge the Description and Additional Information tabs in WooCommerce?

我唯一的问题是我想先显示其他信息。这是屏幕截图: https://i.stack.imgur.com/UTIbf.png 这是该站点的链接:https://adisport.hu/termek/adidas-xz-torsion/

这是我在function.php中使用的代码:

// Remove Additional Info tab
add_filter('woocommerce_product_tabs', 'remove_tab_additional_info', 30);
function remove_tab_additional_info($tabs){
    unset( $tabs['additional_information'] );
    return $tabs;
}

// Add original Additional Info tab info to the end of the_content
add_filter('the_content','add_details_to_content', 10, 1);
function add_details_to_content($content){
    if ( is_product() ){
        global $product;
        $content = '<div class="product-description">'.$content.'</div>';

        ob_start();
        ?><div class="product-additional-info"><?php

        $heading = apply_filters( 'woocommerce_product_additional_information_heading', __( 'Additional information', 'woocommerce' ) );
        if ( !empty($heading) ) {
        ?>
            <h3><?php echo esc_html( $heading ); ?></h3>
        <?php }

        do_action( 'woocommerce_product_additional_information', $product );
        ?></div><?php
        $content .= ob_get_clean();
    }
    return $content;
}

1 个答案:

答案 0 :(得分:0)

尝试以下操作:

MyTextBlock.Text = "Google" + ? + "icon";

经过测试可以正常工作。

相关:Add custom content to WooCommerce product description