<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[13810] trunk: Enable nav menu admin if theme supports widgets.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13810">13810</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-03-24 18:35:31 +0000 (Wed, 24 Mar 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Enable nav menu admin if theme supports widgets.  Show notice if theme supports widgets but not nav-menus. see <a href="http://trac.wordpress.org/ticket/11817">#11817</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminnavmenusphp">trunk/wp-admin/nav-menus.php</a></li>
<li><a href="#trunkwpincludeswidgetsphp">trunk/wp-includes/widgets.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminnavmenusphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/nav-menus.php (13809 => 13810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/nav-menus.php        2010-03-24 15:41:51 UTC (rev 13809)
+++ trunk/wp-admin/nav-menus.php        2010-03-24 18:35:31 UTC (rev 13810)
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx"> 
</span><span class="cx">                 // Add Menu
</span><span class="cx">                 if ( isset($_POST['create-menu-button']) ) {
</span><del>-                        if ( current_theme_supports('nav-menus') ) {
</del><ins>+                        if ( current_theme_supports('nav-menus') || current_theme_supports('widgets') ) {
</ins><span class="cx">                                 $add_nav_menu = esc_html( $_POST['create-menu-name'] );
</span><span class="cx"> 
</span><span class="cx">                                 if ( $add_nav_menu ) {
</span><span class="lines">@@ -214,15 +214,21 @@
</span><span class="cx"> // The user has no menus.
</span><span class="cx"> if ( !is_nav_menu( $nav_menu_selected_id ) ) {
</span><span class="cx">         $messages_div = '&lt;div id=&quot;message&quot; class=&quot;updated&quot;&gt;&lt;p&gt;' . __('You do not have any menus. Create a new menu.') . '&lt;/p&gt;&lt;/div&gt;';
</span><del>-        
</del><ins>+
</ins><span class="cx"> // The theme supports menus
</span><span class="cx"> } elseif ( current_theme_supports('nav-menus') ) {
</span><del>-        
</del><span class="cx">         // Register nav menu metaboxes
</span><span class="cx">         add_meta_box( 'manage-menu', __( 'Menu Settings' ), 'wp_nav_menu_manage_menu_metabox', 'nav-menus', 'side', 'high', array( $nav_menu_selected_id, $nav_menu_selected_title ) );
</span><span class="cx">         wp_nav_menu_metaboxes_setup();
</span><span class="cx"> 
</span><del>-// The theme does not support menus
</del><ins>+// The theme does not support menus but supports widgets
+} elseif ( current_theme_supports('widgets') ) {
+        // Register nav menu metaboxes
+        add_meta_box( 'manage-menu', __( 'Menu Settings' ), 'wp_nav_menu_manage_menu_metabox', 'nav-menus', 'side', 'high', array( $nav_menu_selected_id, $nav_menu_selected_title ) );
+        wp_nav_menu_metaboxes_setup();
+        $messages_div = '&lt;div id=&quot;message&quot; class=&quot;error&quot;&gt;&lt;p&gt;' . __('The current theme does not natively support menus, but you can use the &amp;#8220;Navigation Menu&amp;#8221; widget to add any menus you create here to the theme&amp;#8217;s sidebar.') . '&lt;/p&gt;&lt;/div&gt;';
+
+// The theme supports neither menus nor widgets.
</ins><span class="cx"> } else {
</span><span class="cx">         remove_meta_box( 'create-menu', 'nav-menus', 'side' );
</span><span class="cx">         $messages_div = '&lt;div id=&quot;message&quot; class=&quot;error&quot;&gt;&lt;p&gt;' . __('The current theme does not support menus.') . '&lt;/p&gt;&lt;/div&gt;';
</span><span class="lines">@@ -237,7 +243,7 @@
</span><span class="cx">         &lt;?php echo $messages_div; ?&gt;
</span><span class="cx">         &lt;div class=&quot;hide-if-js error&quot;&gt;&lt;p&gt;&lt;?php _e('You do not have JavaScript enabled in your browser. Please enable it to access the Menus functionality.'); ?&gt;&lt;/p&gt;&lt;/div&gt;
</span><span class="cx"> 
</span><del>-        &lt;?php if ( !empty($nav_menus) &amp;&amp; count($nav_menus) &gt; 1 &amp;&amp; current_theme_supports('nav-menus') ) : ?&gt;
</del><ins>+        &lt;?php if ( !empty($nav_menus) &amp;&amp; count($nav_menus) &gt; 1 &amp;&amp; ( current_theme_supports('nav-menus') || current_theme_supports('widgets') ) ) : ?&gt;
</ins><span class="cx">         &lt;ul class=&quot;subsubsub&quot;&gt;
</span><span class="cx">                 &lt;?php
</span><span class="cx">                         foreach ( $nav_menus as $_nav_menu ) {
</span><span class="lines">@@ -263,7 +269,7 @@
</span><span class="cx">                         &lt;input type=&quot;hidden&quot; id=&quot;hidden-metaboxes&quot; value=&quot;&lt;?php echo wp_initial_nav_menu_meta_boxes(); ?&gt;&quot; /&gt;
</span><span class="cx">                         &lt;div id=&quot;post-body&quot;&gt;
</span><span class="cx">                                 &lt;div id=&quot;post-body-content&quot;&gt;
</span><del>-                                        &lt;?php if ( is_nav_menu($nav_menu_selected_id) &amp;&amp; current_theme_supports('nav-menus') ) : ?&gt;
</del><ins>+                                        &lt;?php if ( is_nav_menu($nav_menu_selected_id) &amp;&amp; ( current_theme_supports('nav-menus') || current_theme_supports('widgets') ) ) : ?&gt;
</ins><span class="cx">                                                 &lt;div id=&quot;menu-container&quot; class=&quot;postbox&quot;&gt;
</span><span class="cx">                                                         &lt;h3 class=&quot;hndle&quot;&gt;&lt;?php echo esc_html( $nav_menu_selected_title ); ?&gt;&lt;/h3&gt;
</span><span class="cx">                                                         &lt;div class=&quot;inside&quot;&gt;
</span></span></pre></div>
<a id="trunkwpincludeswidgetsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/widgets.php (13809 => 13810)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/widgets.php        2010-03-24 15:41:51 UTC (rev 13809)
+++ trunk/wp-includes/widgets.php        2010-03-24 18:35:31 UTC (rev 13810)
</span><span class="lines">@@ -562,6 +562,8 @@
</span><span class="cx"> 
</span><span class="cx">         $wp_registered_sidebars[$sidebar['id']] = $sidebar;
</span><span class="cx"> 
</span><ins>+        add_theme_support('widgets');
+
</ins><span class="cx">         return $sidebar['id'];
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>