カスタム投稿がarchive-投稿タイプ名.phpで表示できない
-
カスタム投稿とカテゴリ設定をfunctions.phpで下記のように設定しました。
register_post_type(‘exgoods’, array( ‘label’ => ‘商品詳細’,’description’ => ”,’public’ => true,’show_ui’ => true,’show_in_menu’ => true,’capability_type’ => ‘post’,’hierarchical’ => true,’rewrite’ => array(‘slug’ => ”),’query_var’ => true,’has_archive’ => true,’exclude_from_search’ => true,’supports’ => array(‘title’,’editor’,’excerpt’,’trackbacks’,’custom-fields’,’comments’,’revisions’,’thumbnail’,’author’,’page-attributes’,),’taxonomies’ => array(‘ctgoods’,),’labels’ => array (
‘name’ => ‘商品詳細’,
‘singular_name’ => ‘exgood’,
‘menu_name’ => ‘商品詳細’,
‘add_new’ => ‘Add exgood’,
‘add_new_item’ => ‘Add New exgood’,
‘edit’ => ‘Edit’,
‘edit_item’ => ‘Edit exgood’,
‘new_item’ => ‘New exgood’,
‘view’ => ‘View exgood’,
‘view_item’ => ‘View exgood’,
‘search_items’ => ‘Search 商品詳細’,
‘not_found’ => ‘No 商品詳細 Found’,
‘not_found_in_trash’ => ‘No 商品詳細 Found in Trash’,
‘parent’ => ‘Parent exgood’,
),) );register_taxonomy(‘ctgoods’,array (
0 => ‘exgoods’,
),array( ‘hierarchical’ => true, ‘label’ => ‘商品カテゴリー’,’show_ui’ => true,’query_var’ => true,’rewrite’ => array(‘slug’ => ”),’singular_label’ => ‘ctgood’) );これで、メニューにはカスタム投稿とそのカテゴリ設定画面が表示されて、商品データの登録もできます。
また、single-exgoods.phpは問題なく表示できます。
しかし、カスタムメニューで作成した、カテゴリを表示するときに、
archive.phpでしか表示できず、archive-投稿タイプ名.phpでは表示できません。
archive-exgoods.phpとarchive-ctgoods.phpの両方を試しましたが、表示が空白になってしまいます。archive.phpであれば、問題なく表示されます。誠に恐れ入りますが、サポート頂ければ助かります。よろしくお願い致します。
- トピック「カスタム投稿がarchive-投稿タイプ名.phpで表示できない」には新たに返信することはできません。