In the wordpress admin menu,
I would like to add a custom post type to a submenu item. For example,
Menu Item -> Submenu Item -> Custom Post Type
I think I am close, but there may be a simpler way to accomplish this. Or is there a way to accomplish this? The other option I was thinking of is having categories for all subitems. Looking for some advice on how and what I should do here.
This is currently have below:
function.php
Menu Item
function admin_menu_experience() {
add_menu_page(
'Experience',
'Experience',
'read',
'test',
'',
'dashicons-admin-users',
40
);
}
add_action( 'admin_menu', 'admin_menu_experience' );
Submenu Item
function admin_submenu_additional_self_test(){
add_submenu_page(
'test',
'Test',
'Test',
'read',
'test',
'',
'dashicons-admin-users',
40
);
}
add_action( 'admin_menu', 'admin_submenu_additional_self_test' );
Custom Post Type
function register_subitem_test() {
$args = array (
'labels' => array (
'name' => __( 'Healthcare', 'healthcare' ),
'singular_name' => __( 'Healthcare', 'healthcare' ),
),
'description' => 'View Available Properties',
'supports' => array( 'title' ),
'public' => true,
'show_ui' => true,
'show_in_menu' => 'test',
// 'taxonomies' => array('category'),
'rewrite' => array('slug' => 'healthcare' ),
'supports' => array('title', 'editor', 'revisions', 'thumbnail'),
);
register_post_type( 'healthcare', $args );
}
add_action( 'init', 'register_subitem_test' );