From 7c181a42bf8c4a0897270b28aba47cd3f9430f42 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 21 Nov 2011 15:35:57 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@19374 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/about.php | 1 + wp-admin/admin-header.php | 5 +++-- wp-admin/credits.php | 1 + wp-admin/freedoms.php | 1 + wp-admin/post-new.php | 15 +++++++++------ wp-content/themes/twentyeleven/image.php | 3 ++- wp-includes/plugin.php | 4 ++-- 7 files changed, 19 insertions(+), 11 deletions(-) diff --git a/wp-admin/about.php b/wp-admin/about.php index 51940f7b0a..6f03234557 100644 --- a/wp-admin/about.php +++ b/wp-admin/about.php @@ -10,6 +10,7 @@ require_once( './admin.php' ); $title = __( 'About' ); +$parent_file = 'about.php'; list( $display_version ) = explode( '-', $wp_version ); diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index f2fa9f5818..e04e0c804e 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -114,10 +114,11 @@ if ( is_network_admin() ) do_action('network_admin_notices'); elseif ( is_user_admin() ) do_action('user_admin_notices'); -else +elseif ( 'about' != $current_screen->parent_base ) do_action('admin_notices'); -do_action('all_admin_notices'); +if ( 'about' != $current_screen->parent_base ) + do_action('all_admin_notices'); if ( $parent_file == 'options-general.php' ) require(ABSPATH . 'wp-admin/options-head.php'); diff --git a/wp-admin/credits.php b/wp-admin/credits.php index a2af340abe..42ce1ded27 100644 --- a/wp-admin/credits.php +++ b/wp-admin/credits.php @@ -10,6 +10,7 @@ require_once( './admin.php' ); $title = __( 'Credits' ); +$parent_file = 'about.php'; add_contextual_help($current_screen, '

' . __('Each name or handle is a link to that person’s profile in the WordPress.org community directory.') . '

' . diff --git a/wp-admin/freedoms.php b/wp-admin/freedoms.php index 93421fcd66..6731df44c2 100644 --- a/wp-admin/freedoms.php +++ b/wp-admin/freedoms.php @@ -10,6 +10,7 @@ require_once( './admin.php' ); $title = __( 'Freedoms' ); +$parent_file = 'about.php'; list( $display_version ) = explode( '-', $wp_version ); diff --git a/wp-admin/post-new.php b/wp-admin/post-new.php index 20374efa08..e4e0812283 100644 --- a/wp-admin/post-new.php +++ b/wp-admin/post-new.php @@ -16,16 +16,19 @@ elseif ( in_array( $_GET['post_type'], get_post_types( array('show_ui' => true ) else wp_die( __('Invalid post type') ); -if ( 'post' != $post_type ) { - $parent_file = "edit.php?post_type=$post_type"; - $submenu_file = "post-new.php?post_type=$post_type"; -} else { +$post_type_object = get_post_type_object( $post_type ); + +if ( 'post' == $post_type ) { $parent_file = 'edit.php'; $submenu_file = 'post-new.php'; +} else { + if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true ) + $parent_file = $post_type_object->show_in_menu; + else + $parent_file = "edit.php?post_type=$post_type"; + $submenu_file = "post-new.php?post_type=$post_type"; } -$post_type_object = get_post_type_object($post_type); - $title = $post_type_object->labels->add_new_item; $editing = true; diff --git a/wp-content/themes/twentyeleven/image.php b/wp-content/themes/twentyeleven/image.php index c6c8544b12..40efb92b50 100644 --- a/wp-content/themes/twentyeleven/image.php +++ b/wp-content/themes/twentyeleven/image.php @@ -34,8 +34,9 @@ get_header(); ?> $metadata['width'], $metadata['height'], esc_url( get_permalink( $post->post_parent ) ), - get_the_title( $post->post_parent ) + $blah = get_the_title( $post->post_parent ) ); + var_dump( $blah ); ?> ', '' ); ?> diff --git a/wp-includes/plugin.php b/wp-includes/plugin.php index bb71d3d3b6..e34133ff7f 100644 --- a/wp-includes/plugin.php +++ b/wp-includes/plugin.php @@ -283,9 +283,9 @@ function remove_all_filters($tag, $priority = false) { if( isset($wp_filter[$tag]) ) { if( false !== $priority && isset($wp_filter[$tag][$priority]) ) - unset($wp_filter[$tag][$priority]); + $wp_filter[$tag][$priority] = array(); else - unset($wp_filter[$tag]); + $wp_filter[$tag] = array(); } if( isset($merged_filters[$tag]) )