From 9f6fe3c4ff3b55d8dd42a79d3e6620911d2c8819 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Wed, 12 Sep 2012 02:16:46 +0000 Subject: [PATCH] Don't show Appearance > Widgets if the theme has no sidebars defined. props SergeyBiryukov for the initial patch. fixes #21761. git-svn-id: http://core.svn.wordpress.org/trunk@21825 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/widgets.php | 19 ++----------------- wp-includes/functions.php | 4 ++++ 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/wp-admin/widgets.php b/wp-admin/widgets.php index a0fe1fee4b..952c4388f7 100644 --- a/wp-admin/widgets.php +++ b/wp-admin/widgets.php @@ -68,23 +68,8 @@ get_current_screen()->set_help_sidebar( '

' . __('Support Forums') . '

' ); -if ( empty($wp_registered_sidebars) ) { - // the theme has no sidebars, die. - require_once( './admin-header.php' ); -?> - -
- -

-
-

-
-

follow these instructions.' ); ?>

-
- -follow these instructions.' ) ); } // These are the widgets grouped by sidebar diff --git a/wp-includes/functions.php b/wp-includes/functions.php index a39c4dbb71..58a7742228 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -2549,6 +2549,10 @@ function wp_maybe_load_widgets() { */ function wp_widgets_add_menu() { global $submenu; + + if ( ! current_theme_supports( 'widgets' ) ) + return; + $submenu['themes.php'][7] = array( __( 'Widgets' ), 'edit_theme_options', 'widgets.php' ); ksort( $submenu['themes.php'], SORT_NUMERIC ); }