我有一个自定义的帖子类型,case-study
, 在我的中定义functions.php
像这样:
function case_study_posttype() {
register_post_type( \'case-study\',
array(
\'labels\' => array(
\'name\' => __( \'Case Studies\' ),
\'singular_name\' => __( \'Case Study\' )
),
\'public\' => true,
\'has_archive\' => true,
\'rewrite\' => array(\'slug\' => \'case-study\'),
\'supports\' => array(\'title\', \'editor\', \'excerpt\', \'author\', \'thumbnail\', \'comments\', \'revisions\', \'custom-fields\'),
\'menu_position\' => 5,
\'menu_icon\' => \'dashicons-format-aside\',
\'taxonomies\' => array(\'category\')
)
);
}
add_action( \'init\', \'case_study_posttype\' );
对于这种帖子类型,我想使用一个自定义模板,因此在我的主题文件夹的根目录中,我创建了一个名为single-case-study.php
, 但是,当我访问permalink进行单个案例研究时,它不是使用single-case-study.php
样板有什么想法吗?