因此,我试图为我的主题创建一个自定义帖子类型。我已经编写了注册帖子类型的函数,可以从管理面板添加帖子,但当我尝试查看新帖子的永久链接时,会得到一个404未找到页面。
以下是我的帖子类型函数:
add_action( \'init\', \'create_press_coverage\' );
function create_press_coverage() {
register_post_type( \'press_coverage\',
array(
\'labels\' => array(
\'name\' => \'Press Coverages\',
\'singular_name\' => \'Press Coverage\',
\'add_new\' => \'Add New\',
\'add_new_item\' => \'Add New Press Coverage\',
\'edit\' => \'Edit\',
\'edit_item\' => \'Edit Press Coverage\',
\'new_item\' => \'New Press Coverage\',
\'view\' => \'View\',
\'view_item\' => \'View Press Coverage\',
\'search_items\' => \'Search Press Coverage\',
\'not_found\' => \'No Press Coverages found\',
\'not_found_in_trash\' => \'No Press Coverages found in Trash\',
\'parent\' => \'Parent Press Coverage\'
),
\'public\' => true,
\'menu_position\' => 8,
\'supports\' => array( \'title\', \'editor\', \'comments\', \'thumbnail\', \'custom-fields\' ),
\'taxonomies\' => array( \'\' ),
\'has_archive\' => true
)
);
}
我使用的是根启动器主题。我是否需要进行一些额外的配置,以使自定义帖子类型能够使用它?
谢谢