サイトに2セットの分類法、デフォルトのWPカテゴリ、およびコンテンツタイプ(「タイプ」)用にfunctions.phpを介して作成した別の分類法があります。
add_action( 'init', 'content_taxonomy', 0 );
function content_taxonomy() {
register_taxonomy(
'type',
'post',
array(
'hierarchical' => true,
'label' => 'Type of Content',
'query_var' => true,
'rewrite' => false
)
);
};
次に、category.phpファイルで、すべての投稿を1つのWPカテゴリに表示し、その下のコンテンツタイプカテゴリ(ビデオ、ブログ投稿、記事などにリンクする投稿)でフィルタリングできるようにします。 。したがって、マイループは次のようになります。
$category = get_category( get_query_var( 'cat' ) );
$cat_id = $category->cat_ID;
query_posts('cat=".$cat_id.", 121') // 121 Being the Video Custom Taxonomy
そして、私はループをフォローアップします。ただし、カスタム分類カテゴリを表示させることはできません。WPカテゴリを取得しているだけです。