WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/19/2010 07:58:02 AM (9 years ago)
Author:
nacin
Message:

Introduce show_in_menu for register_post_type. Allows post types to be a submenu. Accepts boolean and also a parent base. With help from duck_. fixes #14145.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/menu.php

    r15747 r15844  
    106106$_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group
    107107
    108 foreach ( (array) get_post_types( array('show_ui' => true, '_builtin' => false) ) as $ptype ) {
     108foreach ( (array) get_post_types( array('show_ui' => true, '_builtin' => false, 'show_in_menu' => true ) ) as $ptype ) {
    109109    $ptype_obj = get_post_type_object( $ptype );
     110    // Check if it should be a submenu.
     111    if ( $ptype_obj->show_in_menu !== true )
     112        continue;
    110113    $ptype_menu_position = is_int( $ptype_obj->menu_position ) ? $ptype_obj->menu_position : ++$_wp_last_object_menu; // If we're to use $_wp_last_object_menu, increment it first.
    111114    $ptype_for_id = sanitize_html_class( $ptype );
Note: See TracChangeset for help on using the changeset viewer.