タクソノミータームごとに、記事一覧を作りたいなどのサンプル
タクソノミーターム名
記事
記事
記事
タクソノミーターム名
記事
記事
記事
タクソノミーターム名
記事
記事
記事
・
・
のようになる。
<?php $count = 1; $args = array( 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => false, ); $terms = get_terms( 'doc', $args ); foreach ( $terms as $term ) : $term_link = get_term_link( $term, 'タクソノミー名' );//リンク取得 echo '<div>' .$term->name. '</div>' .esc_url( $term_link ). '(' .$term->count; ?> <?php $count++;?> <?php $args = array ( 'post_type' => 'post_type名', 'タクソノミー名' => $term->slug, 'numberposts' => -1, 'orderby' =>'meta_value', 'order' => 'ASC', ); $myposts = get_posts($args); foreach ($myposts as $post) : setup_postdata($post); ?> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <?php endforeach;endforeach; wp_reset_postdata(); ?>