カスタムタクソノミーについて
-
いろいろと検索しましたが、解決法が見当たりませんのでご教示いただければと思います。
カスタム投稿にて、「お役立ち情報コラム」の様なものを作成しています。
add_action( ‘init’, ‘create_post_type’ );
function create_post_type() {
register_post_type(‘column’,
array(
‘label’ => ‘情報コラム’,
‘description’ => ”,
‘public’ => true,
‘show_ui’ => true,
‘show_in_menu’ => true,
‘capability_type’ => ‘post’,
‘hierarchical’ => false,
‘rewrite’ => true,
‘query_var’ => false,
‘has_archive’ => true,
‘exclude_from_search’ => false,
‘menu_position’ => 20,
‘supports’ => array(‘title’,’editor’,’revisions’,’thumbnail’,’custom-fields’,’page-attributes’),
‘taxonomies’ => array(‘column_cat’,’column_tag’),
‘labels’ => array (
‘name’ => ‘情報コラム’,
‘all_items’ => ‘コラム一覧’
)
)
);
register_taxonomy(
‘column_cat’,
‘column’,
array(
‘hierarchical’ => true,
‘label’ => ‘カテゴリ’,
‘show_ui’ => true,
‘query_var’ => true,
‘rewrite’ => array(‘slug’ => ‘column’),
‘singular_label’ => ‘カテゴリ’
)
);register_taxonomy(
‘column_tag’,
‘column’,
array(
‘hierarchical’ => false,
‘label’ => ‘タグ’,
‘show_ui’ => true,
‘query_var’ => true,
‘rewrite’ => array(‘slug’ => ‘column’),
‘singular_label’ => ‘タグ’
)
);
}function.phpに上記の様にカスタム投稿、タグ、カテゴリをカスタムタクソノミーとして定義しました。
テーマファイル内には
archive-column.php、taxonomy-column_tag.php、taxonomy-column_cat.php、
single-column.phpがあります。アーカイブと各記事の表示はうまくいきますが、タグ別のアーカイブ、カテゴリ別のアーカイブは、どちらかがうまくいくと、もう一方が404に引っかかってしまいます。
どちらも、www.example.com/column/ターム名/ で表示させたいのですが、
どうすればいいのでしょうか?
- トピック「カスタムタクソノミーについて」には新たに返信することはできません。