我使用functions.php中的以下代码创建了一个自定义帖子类型 - Press -
// Press Custom Post Type //
function press_custom_init() {
$labels = array(
'name' => _x('Press', 'post type general name'),
'singular_name' => _x('Press', 'post type singular name'),
'add_new' => _x('Add New', 'press'),
'add_new_item' => __('Add New Press Item'),
'edit_item' => __('Edit Item'),
'new_item' => __('New Press Item'),
'view_item' => __('View Press Item'),
'search_items' => __('Search Press'),
'not_found' => __('Nothing found'),
'not_found_in_trash' => __('Nothing found in Trash'),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => false,
'query_var' => true,
'rewrite' => array('slug','pages'),
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => 5,
'supports' => array('title','editor','thumbnail','excerpt',)
);
register_post_type( 'press' , $args );
}
add_action( 'init', 'press_custom_init' );
我已经添加了该帖子类型的项目并在我的导航栏中添加了一个菜单项,但是当我单击链接时,我收到一条“未找到帖子”消息。
你可以在这里看到它:http: //s13.mynewsitereview.com//press
请帮忙!