【发布时间】:2014-11-10 13:59:54
【问题描述】:
长话短说,我正在尝试让自定义帖子类型类别显示“项目项目”的位置,如您所见HERE
我认为这与我在此代码中注册自定义帖子类型的方式有关:
<?php
add_action( 'init', 'register_posts' );
function register_posts() {
register_post_type( 'team_post',
array(
'labels' => array(
'name' => __( "Team" ,"um_lang"),
'singular_name' => __( "Team" ,"um_lang")
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => "project_item", 'with_front' => TRUE),
'supports' => array('title','editor','thumbnail','page-attributes')
)
);
register_post_type( 'project_post',
array(
'labels' => array(
'name' => __( "Projects","um_lang"),
'singular_name' => __( "Project" ,"um_lang")
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => "project_item", 'with_front' => TRUE),
'supports' => array('title','editor','thumbnail','page-attributes')
)
);
register_taxonomy('project_category',array (
0 => 'project_post',
),array( 'hierarchical' => true, 'label' => __('Projects Category',"um_lang"),'show_ui' => true,'query_var' => true,'singular_label' => __('Projects Category',"um_lang")) );
}
?>
【问题讨论】:
-
最近,我遇到了这个问题。 已解决! [#188834][1] [1]:wordpress.stackexchange.com/questions/94817/…
标签: php wordpress rewrite custom-post-type slug