【发布时间】:2019-10-06 15:21:48
【问题描述】:
我想为帖子类型“课程”创建一个类别“大学”。但是,我还希望不仅将大学保留为一个类别,还希望创建自定义帖子类型以显示详细的大学信息。
我已经成功创建了“大学”帖子类型和“课程”帖子类型以及类别。
<?php
function my_plugin() {
// Courses Post type with University as a category
register_post_type( 'Courses', array(
'public' => true,
'taxonomies' => array( 'category' ),
));
// University Post type
register_post_type( 'university', array(
'public' => true,
'taxonomies' => array( 'category' ),
));
}
add_action( 'init', 'my_plugin' );
?>
不知何故,我无法将自定义帖子类型“大学”与“课程”联系起来,使其显示为课程类别以及 CPT 本身。
【问题讨论】:
标签: php wordpress custom-post-type