Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

A project I inherited had a dozen custom post types. Trouble is, they all come off the admin menu sidebar separately. It's not very tidy. Is there a plugin where I can make these subitems of a parent menu, or is there a way, programmatically, I can edit my theme's functions.php to make it make these as submenus?

share|improve this question
add comment

1 Answer 1

up vote 7 down vote accepted

On the function to register a new custom post type can you set this CPT as Submenu to a exist menu item. Use the param show_in_menu

A example:

register_post_type( 
    'issue', 
    apply_filters( 'wpit_register_issue_post_type', 
        array(
            'labels'          => $issue_labels,
            'rewrite'         => $issue_rewrite,
            'supports'        => $issue_supports,
            'taxonomies'      => $issue_taxonomies,
            'menu_position'   => 5,
            'public'          => TRUE,
            'show_ui'         => TRUE,
            'show_in_menu'    => 'edit.php',
            'can_export'      => TRUE,
            'capability_type' => 'post',
            'query_var'       => TRUE
        )
    ) 
);

You find the string for the items on mouse over, like upload.phpon the item Media.

share|improve this answer
2  
I used this handy generator to create a Custom Post Type, and then I installed the free Admin Menu Editor plugin and created a custom menu called "Management" with slug/hook as "mgmt". Next, all I had to do in my auto-generated custom post type code was add the line 'show_in_menu' => 'mgmt', and sure enough -- she works! Thanks so much! –  Volomike Oct 25 '12 at 21:09
    
Welcome. For each job give it an generator ;) –  bueltge Oct 25 '12 at 21:32
    
Yeah, I can't always trust generators to be on the web, so I need to just build my own PHP script that replicates this. Plus, it's pretty easy to use the add_menu_page() function to create the "Management" menu instead of using the Admin Menu Editor. –  Volomike Oct 26 '12 at 0:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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