2017-05-05 55 views
0

以下是WooCommerce添加額外選項卡的代碼: 我的問題是,如何在選項卡內容中插入視頻鏈接或iframe。WooCommerce添加額外的選項卡 - 單個產品頁面


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

    // Adds the new tab 

    $tabs['test_tab'] = array(
     'title'  => __('New Product Tab', 'woocommerce'), 
     'priority' => 50, 
     'callback' => 'woo_new_product_tab_content' 
    ); 

    return $tabs; 

} 
function woo_new_product_tab_content() { 

    // The new tab content 

    echo '<h2>New Product Tab</h2>'; 
    echo '<p>Here\'s your tab content.</p>'; 

} 

如何插入錨文本,或iframe中 「選項卡內容」

任何幫助會感激..

乾杯

+0

我設法弄到了文字,,但是不能插入你管的網址: – Murtuza

+0

echo「我們很快就會在這裏更新視頻」;相反,我想顯示一個iframe .. – Murtuza

+0

完成,,謝謝你們, – Murtuza

回答

0

如果你只是想在標籤內容中顯示靜態視頻iframe,然後在標籤內容回調函數中添加iframe/video標籤ikes

function woo_new_product_tab_content() { 
    // The new tab content 
    echo '<h2>See the video</h2>'; 
    echo '<div><iframe width="100%" height="315" src="paste your video link here" frameborder="0" allowfullscreen></iframe></div>'; } 

或者,如果您想要的動態視頻鏈接的每個產品,那麼你必須能夠存儲在各自的產品薈萃視頻鏈接第一。然後在'src'attr上回顯get_post_meta的視頻。

相關問題