パーマリンクを使用してカスタム投稿タイプのすべてのタクソノミーを一覧表示する簡単な方法はありますか?
taxonomy=title&post_type=company
以下は機能する継ぎ目ではなく、投稿のカテゴリのみをリストしています。
$args = array (
'type' => 'company', //your custom post type
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 0 //shows empty categories
);
$categories = get_categories( $args );
foreach ($categories as $category) {
echo $category->name;
$post_by_cat = get_posts(array('cat' => $category->term_id));
echo '<ul>';
foreach( $post_by_cat as $post ) {
setup_postdata($post);
echo '<li><a href="'.the_permalink().'">'.the_title().'</a></li>';
}
echo '</ul>';
}