If you are wondering how to group multiple post types under one menu, you can easily do this with the show_in_menu
argument when setting up your menu. See below:
$args = array(
'public' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'hierarchical' => false,
'show_in_menu' => 'your-custom-menu-slug.php',
'menu_position' => null,
'supports' => array('title','editor','custom-fields'),
'has_archive' => true
);
register_post_type('your-post-type',$args);
Note: For this to work, show_ui
must also be set to true.
Then you would create a menu using the add_menu_page
function.
function add_your_menu() {
add_menu_page( 'Multiple Post Types Page', 'Multiple Post Types', 'manage_options', 'your-custom-menu-slug.php', 'your_menu_function');
// add_submenu_page() if you want subpages, but not necessary
}
add_action('admin_menu', 'add_your_menu');
In the same fashion, you can also attach post types to any existing menu. For example, it might be useful to attach certain post types to ‘Posts’ and others to ‘Pages’, while others might belong in ‘Tools’. If you attach to an existing menu, you can ignore the add_menu_page
function above and just modify the $args
when registering your custom post type.