Display custom post type menu as submenu

Adding this snippet to the functions.php of your wordpress theme will add a new custom post type however you may notice the ‘show_in_menu’ => ‘edit.php’,. This option will display the custom post type as a submenu within the post edit menu.


function nacin_register_slideshows_post_type() {
register_post_type( 'slideshow', array(
'labels' => array(
'name' => 'Slideshows',
'singular_name' => 'Slideshow',
'public' => true,
'show_ui' => true,
'show_in_menu' => 'edit.php',
'supports' => array( 'title' ,'thumbnail', 'editor' ),
) );
add_action( 'init', 'nacin_register_slideshows_post_type' );

Leave a comment