特定のカスタム投稿タイプのアーカイブへのパーマリンクの取得に関して
-
いつもお世話になっております。
home.phpで「informations」と「eventreports」という2つのカスタム投稿タイプを同じリストで一覧表示しています。各ポストタイトルの横に、「informations」と「eventreports」という、タイプの種類を表示したラベルを付け、さらにそれらをクリックすると、それぞれのアーカイブページに飛ぶように設定したいと思っています。
ラベルを表示することは出来たのですが、パーマリンクが取得できません。
<div id="news" class="box clearfix"> <h2 class="boxTitle">最新情報</h2> <ul class="postList"> <?php $args = array( 'post_type' => array('informations','eventreports'), 'posts_per_page' => 5, ); ?> <?php query_posts( $args ); ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post();?> <li class="clearfix"> <dl> <dt><?php the_time("Y年m月j日") ?></dt> <dd class="listTitle"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></dd> <dd class="listType"><a href="<?php get_post_type_archive_link( $post_type ); ?>"><?php echo esc_html( get_post_type_object( get_post_type() )->labels->singular_name ); ?></a></dd> </dl> </li> <?php endwhile; endif; wp_reset_query(); ?> </ul> </div><!-- News Ends -->
カスタム投稿タイプはCustom Post Type UIを使って追加しています。
なぜか、以下のような記述ではパーマリンクが取得できません。<a href="<?php get_post_type_archive_link( $post_type ); ?>">
よろしければ、誤りがある部分を教えて頂けると幸いです。
よろしくお願いいたします。
4件の返信を表示中 - 1 - 4件目 (全4件中)
4件の返信を表示中 - 1 - 4件目 (全4件中)
- トピック「特定のカスタム投稿タイプのアーカイブへのパーマリンクの取得に関して」には新たに返信することはできません。