カスタム投稿タイプで特定のタームを指定し一覧表示する方法です。
<ul>
<?php
$args = array(
'post_type' => 'recruit',
'tax_query' => array(
array(
'taxonomy' => 'recruit-cat',
'field' => 'slug',
'terms' => array( 'service','sales' )
),
),
'posts_per_page' => 12
); ?>
<?php $my_query = new WP_Query( $args ); ?>
<?php while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
</ul>
例では、「recruit」と言うカスタム投稿タイプのタクソノミー「recruit-cat」に属する「service」「sales」のタームで絞り込み12件表示します。 tax_queryは、条件を指定して記事を取得できるので覚えると便利ですよ。
