2017-03-08 99 views
0

我在woocommerce產品下創建了一個名爲「產品類型」的自定義分類標準。我想將產品類型類別的鏈接添加到單一產品頁面的頁面元素中,類似於已有的類別鏈接。將Wordpress自定義分類鏈接添加到PAge

如何檢索分配給產品的產品類型的名稱和鏈接?

我知道它應該在/下

<?php echo $product->get_categories(', ', '<span class="posted_in">' . _n('Category:', 'Categories:', $cat_count, 'woocommerce') . ' ', '</span>'); ?> 

yourtheme /單品/ meta.php

enter image description here

enter image description here

回答

0

試試這個:

$custom_terms = get_terms('product-type'); 

$loop = new WP_Query($args); 
    if($loop->have_posts()) { 
     echo '<span class="posted_in">'.$custom_term->name.'</span>'; 
    } 
wp_reset_postdata(); 

我不是專家,但我認爲會工作

相關問題