나는 내 가게의 제품 브랜드로 제품 태그를 사용 해왔다. 다음 코드는 온라인에서 발견되어 "woocommerce 및 WP의 최신 업데이트 전까지"내 "브랜드"페이지의 목록을 작성하는 데 성공했습니다. 그것은 각 특정 카테고리 편지 아래에 모든 브랜드를 나열합니다.WooCommerce에서 제품 태그 URL 받기
갑자기 URL이 생성되지 않고, 다른 모든 항목이 갑자기 생성됩니다. 정말 문제를 찾을 수 없습니다. get_terms
을 get_terms(array('taxonomy'=>'product_tag'))
으로 수정하려고했지만 작동하지 않습니다. 내가
$tag_count = sizeof(get_the_terms($post->ID, 'product_tag'));
?>
<div class="single_productbrand">
<?php echo $product->get_tags(', ', '<span class="brand_as">' . _n('', '', $tag_count, 'woocommerce') . ' ', '</span>'); ?>
</div>
과 브랜드를 나열하고 작동 내 제품 페이지에
$list = '';
$tags = get_terms('product_tag');
$groups = array();
if($tags && is_array($tags)) {
foreach($tags as $tag) {
$first_letter = strtoupper($tag->name[0]);
$groups[ $first_letter ][] = $tag;
}
if(!empty($groups)) {
foreach($groups as $letter => $tags) {
$list .= "\n\t" . '<div class="brand_category_container">';
$list .= "\n\t" . '<h4 class="cateogry_letter">' . apply_filters('the_title', $letter) . '</h2>';
$list .= "\n\t" . '<ul>';
foreach($tags as $tag) {
$url = get_tag_link($tag->term_id);
$count = intval($tag->count);
$name = apply_filters('the_title', $tag->name);
$list .= "\n\t\t" . '<li><a class="category_links" href="' . $url . '">' . $name . '</a></li>';
}
$list .= "\n\t" . '</ul></li>';
$list .= "\n\t" . '</div>';
}
}
} else $list .= "\n\t" . '<p>Sorry, but no tags were found</p>';
로해야
어떻게 URL을 다시 얻을 수 있습니다 :
이 내 코드?
var_dump ($ tags); ? –