<!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>[15193] trunk: Switch to current_theme_supports(menus) internally.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/15193">15193</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-06-10 17:57:30 +0000 (Thu, 10 Jun 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Switch to current_theme_supports(menus) internally. Adding theme support for 'nav-menus' is deprecated in favor of register_nav_menu(s). fixes <a href="http://trac.wordpress.org/ticket/13825">#13825</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesnavmenuphp">trunk/wp-admin/includes/nav-menu.php</a></li>
<li><a href="#trunkwpadminmenuphp">trunk/wp-admin/menu.php</a></li>
<li><a href="#trunkwpadminnavmenusphp">trunk/wp-admin/nav-menus.php</a></li>
<li><a href="#trunkwpcontentthemestwentytenfunctionsphp">trunk/wp-content/themes/twentyten/functions.php</a></li>
<li><a href="#trunkwpincludesnavmenuphp">trunk/wp-includes/nav-menu.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesnavmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/nav-menu.php (15192 => 15193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/nav-menu.php        2010-06-10 17:49:55 UTC (rev 15192)
+++ trunk/wp-admin/includes/nav-menu.php        2010-06-10 17:57:30 UTC (rev 15193)
</span><span class="lines">@@ -365,7 +365,7 @@
</span><span class="cx"> **/
</span><span class="cx"> function wp_nav_menu_setup() {
</span><span class="cx">         // Register meta boxes
</span><del>-        if ( ( current_theme_supports( 'widgets' ) || get_registered_nav_menus() ) && wp_get_nav_menus() )
</del><ins>+        if ( wp_get_nav_menus() )
</ins><span class="cx">                 add_meta_box( 'nav-menu-theme-locations', __( 'Theme Locations' ), 'wp_nav_menu_locations_meta_box' , 'nav-menus', 'side', 'default' );
</span><span class="cx">         add_meta_box( 'add-custom-links', __('Custom Links'), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
</span><span class="cx">         wp_nav_menu_post_type_meta_boxes();
</span><span class="lines">@@ -460,14 +460,14 @@
</span><span class="cx"> */
</span><span class="cx"> function wp_nav_menu_locations_meta_box() {
</span><span class="cx">         global $nav_menu_selected_id;
</span><del>-        $locations = get_registered_nav_menus();
</del><span class="cx">
</span><del>-        if ( empty( $locations ) ) {
</del><ins>+        if ( ! current_theme_supports( 'menus' ) ) {
</ins><span class="cx">                 // We must only support widgets. Leave a message and bail.
</span><span class="cx">                 echo '<p class="howto">' . __('The current theme does not natively support menus, but you can use the &#8220;Custom Menu&#8221; widget to add any menus you create here to the theme&#8217;s sidebar.') . '</p>';
</span><span class="cx">                 return;
</span><span class="cx">         }
</span><span class="cx">
</span><ins>+        $locations = get_registered_nav_menus();
</ins><span class="cx">         $menus = wp_get_nav_menus();
</span><span class="cx">         $menu_locations = get_nav_menu_locations();
</span><span class="cx">         $num_locations = count( array_keys($locations) );
</span></span></pre></div>
<a id="trunkwpadminmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/menu.php (15192 => 15193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/menu.php        2010-06-10 17:49:55 UTC (rev 15192)
+++ trunk/wp-admin/menu.php        2010-06-10 17:57:30 UTC (rev 15193)
</span><span class="lines">@@ -157,12 +157,12 @@
</span><span class="cx"> if ( current_user_can( 'switch_themes') ) {
</span><span class="cx">         $menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' );
</span><span class="cx">                 $submenu['themes.php'][5] = array(__('Themes'), 'switch_themes', 'themes.php');
</span><del>-                if ( current_theme_supports( 'nav-menus' ) || current_theme_supports( 'widgets' ) )
</del><ins>+                if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
</ins><span class="cx">                         $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php');
</span><span class="cx"> } else {
</span><span class="cx">         $menu[60] = array( __('Appearance'), 'edit_theme_options', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' );
</span><span class="cx">                 $submenu['themes.php'][5] = array(__('Themes'), 'edit_theme_options', 'themes.php');
</span><del>-                if ( current_theme_supports( 'nav-menus' ) || current_theme_supports( 'widgets' ) )
</del><ins>+                if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
</ins><span class="cx">                         $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php' );
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpadminnavmenusphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/nav-menus.php (15192 => 15193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/nav-menus.php        2010-06-10 17:49:55 UTC (rev 15192)
+++ trunk/wp-admin/nav-menus.php        2010-06-10 17:57:30 UTC (rev 15193)
</span><span class="lines">@@ -15,7 +15,7 @@
</span><span class="cx"> // Load all the nav menu interface functions
</span><span class="cx"> require_once( ABSPATH . 'wp-admin/includes/nav-menu.php' );
</span><span class="cx">
</span><del>-if ( ! current_theme_supports( 'nav-menus' ) && ! current_theme_supports( 'widgets' ) )
</del><ins>+if ( ! current_theme_supports( 'menus' ) && ! current_theme_supports( 'widgets' ) )
</ins><span class="cx">         wp_die( __( 'Your theme does not support navigation menus or widgets.' ) );
</span><span class="cx">
</span><span class="cx"> // Permissions Check
</span><span class="lines">@@ -433,7 +433,7 @@
</span><span class="cx"> wp_nav_menu_setup();
</span><span class="cx"> wp_initial_nav_menu_meta_boxes();
</span><span class="cx">
</span><del>-if ( ! get_registered_nav_menus() && ! wp_get_nav_menus() )
</del><ins>+if ( ! current_theme_supports( 'menus' ) && ! wp_get_nav_menus() )
</ins><span class="cx">         echo '<div id="message" class="updated"><p>' . __('The current theme does not natively support menus, but you can use the &#8220;Custom Menu&#8221; widget to add any menus you create here to the theme&#8217;s sidebar.') . '</p></div>';
</span><span class="cx">
</span><span class="cx"> $help = '<p>' . __('This feature is new in version 3.0; to use a custom menu in place of your theme&#8217;s default menus, support for this feature must be registered in the theme&#8217;s functions.php file. If your theme does not support the custom menus feature yet (the new default theme, Twenty Ten, does), you can learn about adding support yourself by following the below link.') . '</p>';
</span></span></pre></div>
<a id="trunkwpcontentthemestwentytenfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-content/themes/twentyten/functions.php (15192 => 15193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-content/themes/twentyten/functions.php        2010-06-10 17:49:55 UTC (rev 15192)
+++ trunk/wp-content/themes/twentyten/functions.php        2010-06-10 17:57:30 UTC (rev 15193)
</span><span class="lines">@@ -61,7 +61,8 @@
</span><span class="cx"> * To override twentyten_setup() in a child theme, add your own twentyten_setup to your child theme's
</span><span class="cx"> * functions.php file.
</span><span class="cx"> *
</span><del>- * @uses add_theme_support() To add support for post thumbnails, navigation menus, and automatic feed links.
</del><ins>+ * @uses add_theme_support() To add support for post thumbnails and automatic feed links.
+ * @uses register_nav_menus() To add support for navigation menus.
</ins><span class="cx"> * @uses add_custom_background() To add support for a custom background.
</span><span class="cx"> * @uses add_editor_style() To style the visual editor.
</span><span class="cx"> * @uses load_theme_textdomain() For translation/localization support.
</span></span></pre></div>
<a id="trunkwpincludesnavmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/nav-menu.php (15192 => 15193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/nav-menu.php        2010-06-10 17:49:55 UTC (rev 15192)
+++ trunk/wp-includes/nav-menu.php        2010-06-10 17:57:30 UTC (rev 15193)
</span><span class="lines">@@ -73,7 +73,7 @@
</span><span class="cx"> function register_nav_menus( $locations = array() ) {
</span><span class="cx">         global $_wp_registered_nav_menus;
</span><span class="cx">
</span><del>-        add_theme_support( 'nav-menus' );
</del><ins>+        add_theme_support( 'menus' );
</ins><span class="cx">
</span><span class="cx">         $_wp_registered_nav_menus = array_merge( (array) $_wp_registered_nav_menus, $locations );
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>