<?php $taxonomy_names = get_post_taxonomies(); $terms = get_the_terms($post->ID,$taxonomy_names); foreach( $terms as $term ) { $slug = $term->slug; // スラッグ } <?php if(have_posts()): while(have_posts()): the_post(); the_content(); endwhile; endif; ?> <ul class="cf-result-naborhood"> <li><?php previous_post_link('« %link', '%title', true,"", $slug); ?></li> <li><?php next_post_link('%link »', '%title', true,"", $slug); ?></li> </ul>
カスタム投稿の特定タームの詳細記事をタームしばりで
横遷移させたく、previous_post_link,next_post_linkをつけているのですが、
何も表示されません。。上記では間違ってますでしょうか?
<?php previous_post_link(); ?>
引数なしで記述すると正常に表示されますが、
全タームが範疇になってしまうので、親ターム内のみに絞りたいです。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。