8

I'm not sure where to start with this one.

I want to have 4 custom post types (Gigs, Venues, Holidays and Potentials) listed under a main heading of Events Manager, but don't want Events Manager to be a custom post type.

Thanks in advance to anyone who can help.

4
  • There is not enough information here for us to help you - please clarify what "Events Manager" is, what code you are currently using to output the menu, whether this is indeed a nav menu (a particular feature in WordPress) or a menu generated by other means. May 15 '16 at 17:19
  • Events Manager just needs to be a top-level menu name, it doesn't need to do anything, other than contain the custom post types within it. So far, I have tried creating a custom post type and appending the other custom post types using 'show-in-menu- => 'edit.php?post_type=events-manager', but as I have said, I don't want Events Manager to be a custom post type.
    – sgspragg
    May 15 '16 at 17:31
  • Got it! You should edit your question to make it clear you are referring to the admin menu. I will work on a solution and get back to you. May 15 '16 at 17:33
  • I will ensure to edit the question in future. Thank you.
    – sgspragg
    May 15 '16 at 17:36
14

Just create a "placeholder" menu that you can then assign all your post types to:

function wpse_226690_admin_menu() {
    add_menu_page(
        'Events Manager',
        'Events Manager',
        'read',
        'events-manager',
        '', // Callback, leave empty
        'dashicons-calendar',
        1 // Position
    );
}

add_action( 'admin_menu', 'wpse_226690_admin_menu' );

And then in your register_post_type calls:

'show_in_menu' => 'events-manager',

Tada!

1
  • I had tried something close to this earlier, but was using a different way to 'show_in_menu'. I've also watered down the amount of data to create the custom post type and along with your code I now have it working as expected, so thank you very much!
    – sgspragg
    May 15 '16 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.