我不知道如何找出我的代码出了什么问题,为什么自定义帖子类型“Book”没有显示在我的仪表板上,我以管理员身份登录,我使用的是最新安装的WordPress 3.4.1
这里有我的代码
function codex_custom_init() {
$labels = array(
\'name\' => _x(\'Books\', \'post type general name\'),
\'singular_name\' => _x(\'Book\', \'post type singular name\'),
\'add_new\' => _x(\'Add New\', \'book\'),
\'add_new_item\' => __(\'Add New Book\'),
\'edit_item\' => __(\'Edit Book\'),
\'new_item\' => __(\'New Book\'),
\'all_items\' => __(\'All Books\'),
\'view_item\' => __(\'View Book\'),
\'search_items\' => __(\'Search Books\'),
\'not_found\' => __(\'No books found\'),
\'not_found_in_trash\' => __(\'No books found in Trash\'),
\'parent_item_colon\' => \'\',
\'menu_name\' => __(\'Books\')
);
$capabilities = array(
\'publish_posts\' => \'publish_books\',
\'edit_posts\' => \'edit_books\',
\'edit_others_posts\' => \'edit_others_books\',
\'delete_posts\' => \'delete_books\',
\'delete_others_posts\' => \'delete_others_books\',
\'read_private_posts\' => \'read_private_books\',
\'edit_post\' => \'edit_book\',
\'delete_post\' => \'delete_book\',
\'read_post\' => \'read_book\'
);
$args = array(
\'labels\' => $labels,
\'public\' => true,
\'publicly_queryable\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'query_var\' => true,
\'rewrite\' => true,
\'capability_type\' => \'book\',
\'capabilities\' => $capabilities,
\'has_archive\' => true,
\'hierarchical\' => false,
\'menu_position\' => null,
\'supports\' => array( \'title\', \'editor\', \'author\', \'thumbnail\', \'excerpt\', \'comments\' )
);
register_post_type(\'book\',$args);
}
add_action( \'init\', \'codex_custom_init\' );
我的代码是添加具有自定义功能的新自定义帖子,以使用
members plugin.