第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

將產(chǎn)品標簽移至 WooCommerce 產(chǎn)品描述

將產(chǎn)品標簽移至 WooCommerce 產(chǎn)品描述

PHP
Qyouu 2022-01-02 19:39:05
我需要將產(chǎn)品標簽移到 WooCommerce 產(chǎn)品描述的底部。我正在使用“將自定義內(nèi)容添加到 WooCommerce 產(chǎn)品描述中”真正有效的答案代碼,我在產(chǎn)品描述下方收到文本“這是描述中的最后一行”...現(xiàn)在我想添加產(chǎn)品元信息(產(chǎn)品 SKU 和標簽),但我不知道該怎么做。任何幫助表示贊賞。我正在使用 Storefront 子主題……
查看完整描述

1 回答

?
江戶川亂折騰

TA貢獻1851條經(jīng)驗 獲得超5個贊

產(chǎn)品元數(shù)據(jù)與模板一起顯示single-product/meta.php,因此您只需要使用專用函數(shù)調(diào)用它即可wc_get_template()。


現(xiàn)在,由于它用于過濾器鉤子,其中使用變量返回顯示,您需要啟用 PHP 緩沖......


那是最終的代碼:


// remove the product meta data

remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );


add_filter( 'the_content', 'woocommerce_product_description_and_meta' );

function woocommerce_product_description_and_meta( $content ) {


    // Only for single product pages (woocommerce)

    if ( is_product() ) {

        global $post, $product;


        ob_start(); // Start buffering


        // The product meta information

        wc_get_template( 'single-product/meta.php' );


        // Inserting the product meta information display at the end

        $content .= ob_get_clean(); // append the buffered display

    }

    return $content;

}

代碼位于活動子主題(或活動主題)的 functions.php 文件中。測試和工作。


查看完整回答
反對 回復(fù) 2022-01-02
  • 1 回答
  • 0 關(guān)注
  • 203 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號