カスタム投稿タイプ「リソース」内にあるすべてのタグを取得しようとしています。
問題は、私がループの外にいて、機能をカスタム投稿タイプで動作させる方法を見つけるのに苦労していることです。
「resource_category」としてもカテゴリを設定しています
私の現在のコードは次のとおりです。
$tax = 'post_tag';
$terms = get_terms( $tax );
$count = count( $terms );
if ( $count > 0 ): ?>
<div class="post-tags">
<?php
foreach ( $terms as $term ) {
$term_link = get_term_link( $term, $tax );
echo '<a href="' . $term_link . '" class="tax-filter" title="' . $term->slug . '">' . $term->name . '</a> ';
} ?>
</div>
<?php endif;
誰でも助けることができますか?