0
我試圖在WordPress中獲取標籤描述並顯示,但沒有成功。我在下面評論了我添加的內容以獲取標籤描述。獲取標籤描述並在WordPress中顯示
<?php
$q_categories = $_GET['categories'];
$q_tags = $_GET['tags'];
$term_id = 26;
$taxonomy_name = 'tags';
$termchildren = get_term_children($term_id, $taxonomy_name);
$description = tag_description(); //NOT WORKING
foreach ($termchildren as $child) {
$term = get_term_by('id', $child, $taxonomy_name, $description);
$tag_image = get_field('tag_image', $term);
$show_on_landing_page = get_field('show_on_landing_page', $term);
if ($show_on_landing_page) { ?>
<div class="box three columns">
<div class="box-content slidedown">
<? if(!empty($tag_image)): ?><img src="<? echo the_field('tag_image', $term); ?>" class="cover cat-img" /><?php endif; ?>
<div class="details">
<div class="details-container">
<h4><? echo $term->name; //NOT WORKING ?></h4>
<p><? echo $term->description; ?></p>
<a href="?tags=<? echo $term->slug; ?>" class="btn hvr-bounce-to-right">View Work</a>
</div>
</div>
</div>
</div>
<? } ?>
<? } ?>
您尚未將標記ID傳遞給該函數......它無法知道您想要的標記描述。 – rnevius
我需要它來爲父標籤26的所有子標籤工作 – Amesey