投稿ページのカテゴリ名、もしくはターム名を取得
リンク無し
「〇〇〇」はカスタム投稿タイプスラッグ、投稿場合はpostを挿入
<?php
$terms = get_the_terms( $post -> ID, '○○○○' );
foreach ( $terms as $term ){
echo '<h1>'.$term->name.'</h1>';
}
?>リンクを入れる
「〇〇〇」はカスタム投稿タイプスラッグ、投稿場合はpostを挿入
<?php
$terms = get_the_terms( $post -> ID, '○○○○' );
foreach ( $terms as $term ){
$term_link = get_term_link( $term );
if ( !is_wp_error( $term_link ) ) {
echo '<h1><a href="' . esc_url( $term_link ) . '">' . $term->name . '</a></h1>';
}
}
?>関連の記事
-

板浪雅樹
-

TREVOスタッフ
-

ホームページ制作に役立つ、おすすめのGoogle Chrome拡張機能
衣川知秀
-

TREVOスタッフ
-
衣川知秀
-

【徹底解説】Google検索オフィスアワー2025年2月27日の全貌と実践的ポイント
板浪雅樹









