Make WordPress Core


Ignore:
Timestamp:
11/21/2011 03:35:57 PM (14 years ago)
Author:
nacin
Message:

Set $parent_file for post-new.php when show_in_menu is a file. Provides for correct top-level highlighting. $submenu_file remains set to expect a post-new.php menu. see #19125.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/post-new.php

    r17748 r19374  
    1717    wp_die( __('Invalid post type') );
    1818
    19 if ( 'post' != $post_type ) {
    20     $parent_file = "edit.php?post_type=$post_type";
    21     $submenu_file = "post-new.php?post_type=$post_type";
    22 } else {
     19$post_type_object = get_post_type_object( $post_type );
     20
     21if ( 'post' == $post_type ) {
    2322    $parent_file = 'edit.php';
    2423    $submenu_file = 'post-new.php';
     24} else {
     25    if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true )
     26        $parent_file = $post_type_object->show_in_menu;
     27    else
     28        $parent_file = "edit.php?post_type=$post_type";
     29    $submenu_file = "post-new.php?post_type=$post_type";
    2530}
    26 
    27 $post_type_object = get_post_type_object($post_type);
    2831
    2932$title = $post_type_object->labels->add_new_item;
Note: See TracChangeset for help on using the changeset viewer.