我创建了多种自定义帖子类型,并且后端菜单变得凌乱,因为我有20种帖子类型。
我想将我所有的帖子类型都放在一个管理菜单项下(称为“ Alle帖子类型”),我可以正常工作,但我只能选择“所有[自定义帖子类型]”选项。
我希望菜单项“ Recepten”中包含生物分类和“ add Recept”按钮,就像您将“ show_in_menu”设置为true一样。
用于创建自定义帖子类型“ Recepten”的代码是
function recepten_post_type()
{
$labels = array(
'name' => _x('Recepten', 'Post Type General Name', 'jointswp'),
'singular_name' => _x('Recept', 'Post Type Singular Name', 'jointswp'),
'menu_name' => __('Recepten', 'jointswp'),
'name_admin_bar' => __('Recepten', 'jointswp'),
'archives' => __('Recepten bibliotheek', 'jointswp'),
'attributes' => __('Recept Attributen', 'jointswp'),
'parent_item_colon' => __('Parent Item:', 'jointswp'),
'all_items' => __('Alle Recepten', 'jointswp'),
'add_new_item' => __('Voeg Recept toe', 'jointswp'),
'add_new' => __('Add New', 'jointswp'),
'new_item' => __('Nieuwe Recept', 'jointswp'),
'edit_item' => __('Bewerk Recept', 'jointswp'),
'update_item' => __('Update Recept', 'jointswp'),
'view_item' => __('Bekijk Recept', 'jointswp'),
'view_items' => __('Bekijk Recepten', 'jointswp'),
'search_items' => __('Zoek Recept', 'jointswp'),
'not_found' => __('Not found', 'jointswp'),
'not_found_in_trash' => __('Not found in Trash', 'jointswp'),
'featured_image' => __('Featured Image', 'jointswp'),
'set_featured_image' => __('Set featured image', 'jointswp'),
'remove_featured_image' => __('Remove featured image', 'jointswp'),
'use_featured_image' => __('Use as featured image', 'jointswp'),
'insert_into_item' => __('Voeg toe aan Recept', 'jointswp'),
'uploaded_to_this_item' => __('Uploaded to this item', 'jointswp'),
'items_list' => __('Items list', 'jointswp'),
'items_list_navigation' => __('Items list navigation', 'jointswp'),
'filter_items_list' => __('Filter items list', 'jointswp'),
);
$args = array(
'label' => __('Recepten', 'jointswp'),
'description' => __('Recepten Verstege', 'jointswp'),
'labels' => $labels,
'supports' => array('title', 'thumbnail', 'page-attributes'),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => 'post-types',
'show_in_rest' => true,
'menu_position' => 11,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
'rewrite' => array(
'slug' => 'recepten',
)
);
register_post_type('recept', $args);
}
add_action('init', 'recepten_post_type', 0);
我如何创建自定义计程车就是这样
function create_recipe_custom_taxonomy()
{
$labels = array(
'name' => _x('Recept Filter', 'taxonomy general name'),
'singular_name' => _x('Filter', 'taxonomy singular name'),
'search_items' => __('Zoek filter'),
'all_items' => __('Alle Filters'),
'parent_item' => __('HoofdFilter'),
'parent_item_colon' => __('HoofdFilter:'),
'edit_item' => __('Edit Filter'),
'update_item' => __('Update Filter'),
'add_new_item' => __('Nieuwe Filter'),
'new_item_name' => __('Nieuwe Filter'),
'menu_name' => __('Filters'),
);
register_taxonomy('recipe-filters', array('recept'), array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'show_in_menu' => 'post-types',
'rewrite' => array('slug' => 'filter'),
));
}
add_action('init', 'create_recipe_custom_taxonomy', 1);
我希望有人能帮助我!