<!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" />
<title>[23441] trunk/wp-admin: Improve the UX of the Nav Menus screen.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { 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 #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#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>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/23441">23441</a></dd>
<dt>Author</dt> <dd>markjaquith</dd>
<dt>Date</dt> <dd>2013-02-16 04:53:59 +0000 (Sat, 16 Feb 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Improve the UX of the Nav Menus screen. Kill the tabs, and change to a
dropdown, unless you have zero or one menus (which is the most common),
in which case you jump right into editing your sole menu.

Do assignment to location using checkboxes in the main menu editing
section instead of the backwards menu =&gt; location assignment in a
random meta box.

More to come, but this gets us started.

props lessbloat, DrewAPicture, jkudish. see <a href="http://core.trac.wordpress.org/ticket/23119">#23119</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmincsscolorsfreshcss">trunk/wp-admin/css/colors-fresh.css</a></li>
<li><a href="#trunkwpadmincsswpadminrtlcss">trunk/wp-admin/css/wp-admin-rtl.css</a></li>
<li><a href="#trunkwpadmincsswpadmincss">trunk/wp-admin/css/wp-admin.css</a></li>
<li><a href="#trunkwpadminincludesnavmenuphp">trunk/wp-admin/includes/nav-menu.php</a></li>
<li><a href="#trunkwpadminjsnavmenujs">trunk/wp-admin/js/nav-menu.js</a></li>
<li><a href="#trunkwpadminnavmenusphp">trunk/wp-admin/nav-menus.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmincsscolorsfreshcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/colors-fresh.css (23440 => 23441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/colors-fresh.css        2013-02-16 03:59:37 UTC (rev 23440)
+++ trunk/wp-admin/css/colors-fresh.css        2013-02-16 04:53:59 UTC (rev 23441)
</span><span class="lines">@@ -400,7 +400,8 @@
</span><span class="cx"> 
</span><span class="cx"> .submitbox .submitdelete:hover,
</span><span class="cx"> #media-items a.delete:hover,
</span><del>-#media-items a.delete-permanently:hover {
</del><ins>+#media-items a.delete-permanently:hover,
+#nav-menu-footer .menu-delete:hover {
</ins><span class="cx">         color: #fff;
</span><span class="cx">         background-color: #f00;
</span><span class="cx">         border-bottom-color: #f00;
</span><span class="lines">@@ -1682,6 +1683,27 @@
</span><span class="cx">         background: #21759b;
</span><span class="cx">         color: #fff;
</span><span class="cx"> }
</span><ins>+
+.manage-menus {
+        border: 1px solid #eeeeee;
+        background: #fbfbfb;
+}
+
+.menu-settings {
+        border-top: 1px solid #eeeeee;
+}
+
+.theme-location-set {
+        color: #999999;
+}
+
+.nav-menus-php .delete-action a {
+        color: #bc0b0b;
+}
+
+.is-submenu {
+        color: #999999;
+}
</ins><span class="cx"> /* end added from nav-menu.css */
</span><span class="cx"> 
</span><span class="cx"> .nav-tab {
</span></span></pre></div>
<a id="trunkwpadmincsswpadminrtlcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/wp-admin-rtl.css (23440 => 23441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/wp-admin-rtl.css        2013-02-16 03:59:37 UTC (rev 23440)
+++ trunk/wp-admin/css/wp-admin-rtl.css        2013-02-16 04:53:59 UTC (rev 23441)
</span><span class="lines">@@ -44,6 +44,8 @@
</span><span class="cx"> 25.0 - TinyMCE tweaks
</span><span class="cx"> 26.0 - Full Overlay w/ Sidebar
</span><span class="cx"> 27.0 - Customize Loader
</span><ins>+28.0 - Nav Menus
+29.0 - HiDPI
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> ------------------------------------------------------------------------------*/
</span><span class="lines">@@ -2303,10 +2305,6 @@
</span><span class="cx">         margin-right:0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.auto-add-pages {
-        float: right;
-}
-
</del><span class="cx"> /* Star ratings */
</span><span class="cx"> div.star-holder {
</span><span class="cx">         background: url('../images/stars-rtl.png?ver=20121108') repeat-x bottom right;
</span><span class="lines">@@ -2543,9 +2541,38 @@
</span><span class="cx">         left: 20px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-/**
- * HiDPI Displays
- */
</del><ins>+/*------------------------------------------------------------------------------
+  28.0 - Nav Menus
+------------------------------------------------------------------------------*/
+.nav-menus-php .major-publishing-actions .publishing-action {
+        float: left;
+}
+
+.menu-settings dd {
+        float: right;
+        padding-right: 170px;
+}
+
+.manage-menus span {
+        float: right;
+}
+
+.menu-settings dt {
+        left: auto;
+        right: 0;
+}
+
+.menu-settings dd input,
+.menu-settings dd span,
+.menu-settings dd label,
+.manage-menus select {
+        float: right;
+        margin-right: 6px;
+}
+
+/*------------------------------------------------------------------------------
+  29.0 - HiDPI
+------------------------------------------------------------------------------*/
</ins><span class="cx"> @media print,
</span><span class="cx">   (-o-min-device-pixel-ratio: 5/4),
</span><span class="cx">   (-webkit-min-device-pixel-ratio: 1.25),
</span></span></pre></div>
<a id="trunkwpadmincsswpadmincss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/wp-admin.css (23440 => 23441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/wp-admin.css        2013-02-16 03:59:37 UTC (rev 23440)
+++ trunk/wp-admin/css/wp-admin.css        2013-02-16 04:53:59 UTC (rev 23441)
</span><span class="lines">@@ -6704,8 +6704,17 @@
</span><span class="cx"> 
</span><span class="cx"> /* nav-menu */
</span><span class="cx"> 
</span><ins>+.nav-menus-php #message {
+        display: none;
+}
+
+.no-js #message {
+        display: block;
+}
+
</ins><span class="cx"> #nav-menus-frame {
</span><span class="cx">         margin-left: 300px;
</span><ins>+        margin-top: 28px;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #wpbody-content #menu-settings-column {
</span><span class="lines">@@ -6714,13 +6723,9 @@
</span><span class="cx">         margin-left: -300px;
</span><span class="cx">         clear: both;
</span><span class="cx">         float: left;
</span><del>-        padding-top: 24px;
</del><ins>+        padding-top: 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-.no-js #wpbody-content #menu-settings-column {
-        padding-top: 31px;
-}
-
</del><span class="cx"> #menu-settings-column .inside {
</span><span class="cx">         clear: both;
</span><span class="cx">         margin: 10px 0 0;
</span><span class="lines">@@ -6739,10 +6744,89 @@
</span><span class="cx">         position: relative;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.blank-slate .menu-name {
+        height: 2em;
+}
+
+.blank-slate .menu-settings {
+        border: none;
+        margin-top: 0;
+        padding-top: 0;
+        overflow: hidden;
+}
+
+.is-submenu {
+        font-style: italic;
+        font-weight: normal;
+        margin-left: 4px;
+}
+
+.manage-menus {
+        margin-top: 13px;
+        padding: 10px;
+        overflow: hidden;
+        -webkit-border-radius: 3px;
+        border-radius: 3px;
+}
+
+.manage-menus select {
+        float: left;
+        margin-right: 6px;
+}
+
+.manage-menus .selected-menu {
+        float: left;
+        margin: 5px 6px 0 0;
+}
+
+.manage-menus .submit-btn {
+        float: left;
+        margin-top: 1px;
+}
+
+.menu-edit p {
+        margin: .3em 0 .6em;
+}
+
+.menu-settings {
+        margin-top: 2em;
+        padding-top: 16px;
+        overflow: hidden;
+}
+
+.menu-settings dl {
+        margin: 0 0 10px;
+        overflow: hidden;
+        position: relative;
+}
+
+.menu-settings dd {
+        float: left;
+        margin: 0;
+        width: 60%;
+        padding-left: 170px;
+}
+
+.menu-settings dt {
+        clear: both;
+        left: 0;
+        padding: 3px 0 0;
+        position: absolute;
+}
+
+.menu-edit .checkbox-input {
+        margin-top: 4px;
+}
+
+.theme-location-set {
+        font-size: 11px;
+}
+
</ins><span class="cx"> /* Menu Container */
</span><span class="cx"> #menu-management-liquid {
</span><span class="cx">         float: left;
</span><span class="cx">         min-width: 100%;
</span><ins>+        margin-top: 3px;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #menu-management {
</span><span class="lines">@@ -6757,7 +6841,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .nav-menus-php #post-body {
</span><del>-        padding: 10px;
</del><ins>+        padding: 0 10px;
</ins><span class="cx">         border-width: 1px 0;
</span><span class="cx">         border-style: solid;
</span><span class="cx"> }
</span><span class="lines">@@ -6769,8 +6853,13 @@
</span><span class="cx"> 
</span><span class="cx"> #nav-menu-header {
</span><span class="cx">         border-bottom: 1px solid;
</span><ins>+        margin-bottom: 13px;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#nav-menu-header .menu-name-label {
+        margin-top: 2px;
+}
+
</ins><span class="cx"> #nav-menu-footer {
</span><span class="cx">         border-top: 1px solid;
</span><span class="cx"> }
</span><span class="lines">@@ -6789,54 +6878,6 @@
</span><span class="cx">         font-weight:bold;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-/* Menu Tabs */
-
-#menu-management .nav-tabs-nav {
-        margin: 0 20px;
-}
-
-#menu-management .nav-tabs-arrow {
-        width: 10px;
-        padding: 0 5px 4px;
-        cursor: pointer;
-        position: absolute;
-        top: 0;
-        line-height: 22px;
-        font-size: 18px;
-}
-
-#menu-management .nav-tabs-arrow-left {
-        left: 0;
-}
-
-#menu-management .nav-tabs-arrow-right {
-        right: 0;
-        text-align: right;
-}
-
-#menu-management .nav-tabs-wrapper {
-        width: 100%;
-        height: 28px;
-        margin-bottom: -1px;
-        overflow: hidden;
-}
-
-#menu-management .nav-tabs {
-        padding-left: 20px;
-        padding-right: 10px;
-}
-
-.js #menu-management .nav-tabs {
-        float: left;
-        margin-left: 0px;
-        margin-right: -400px;
-}
-
-#menu-management .nav-tab {
-        margin-bottom: 0;
-        font-size: 14px;
-}
-
</del><span class="cx"> #select-nav-menu-container {
</span><span class="cx">         text-align: right;
</span><span class="cx">         padding: 0 10px 3px 10px;
</span><span class="lines">@@ -7033,7 +7074,8 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #menu-to-edit {
</span><del>-        padding: 1em 0;
</del><ins>+        margin: 0;
+        padding: 0.1em 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .menu ul {
</span><span class="lines">@@ -7049,7 +7091,7 @@
</span><span class="cx">         clear:both;
</span><span class="cx">         line-height:1.5em;
</span><span class="cx">         position:relative;
</span><del>-        margin: 13px 0 0 0;
</del><ins>+        margin: 9px 0 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .menu-item-handle {
</span><span class="lines">@@ -7269,34 +7311,16 @@
</span><span class="cx">         text-align: right;
</span><span class="cx">         float: right;
</span><span class="cx">         line-height: 23px;
</span><del>-        margin: 5px 0 1px;
</del><ins>+        margin: 2px 0 1px;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-.nav-menus-php .major-publishing-actions .delete-action {
-        vertical-align: middle;
-        text-align: left;
-        float: left;
-        padding-right: 15px;
-        margin-top: 5px;
</del><ins>+.nav-menus-php .blank-slate .menu-settings {
+        display: none;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-.menu-name-label span,
-.auto-add-pages label {
-        font-size: 12px;
-        font-style: normal;
-}
-
-.menu-name-label {
-        margin-right: 15px;
-}
-
-.auto-add-pages input {
-        margin-top: 0;
-}
-
-.auto-add-pages {
-        margin-top: 4px;
</del><ins>+.nav-menus-php .delete-action {
</ins><span class="cx">         float: left;
</span><ins>+        margin-top: 2px;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .nav-menus-php .submitbox .submitcancel {
</span></span></pre></div>
<a id="trunkwpadminincludesnavmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/nav-menu.php (23440 => 23441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/nav-menu.php        2013-02-16 03:59:37 UTC (rev 23440)
+++ trunk/wp-admin/includes/nav-menu.php        2013-02-16 04:53:59 UTC (rev 23441)
</span><span class="lines">@@ -81,11 +81,15 @@
</span><span class="cx"> 
</span><span class="cx">                 $title = empty( $item-&gt;label ) ? $title : $item-&gt;label;
</span><span class="cx"> 
</span><ins>+                $submenu_text = '';
+                if ( 0 == $depth )
+                        $submenu_text = 'style=&quot;display: none;&quot;';
+
</ins><span class="cx">                 ?&gt;
</span><span class="cx">                 &lt;li id=&quot;menu-item-&lt;?php echo $item_id; ?&gt;&quot; class=&quot;&lt;?php echo implode(' ', $classes ); ?&gt;&quot;&gt;
</span><span class="cx">                         &lt;dl class=&quot;menu-item-bar&quot;&gt;
</span><span class="cx">                                 &lt;dt class=&quot;menu-item-handle&quot;&gt;
</span><del>-                                        &lt;span class=&quot;item-title&quot;&gt;&lt;?php echo esc_html( $title ); ?&gt;&lt;/span&gt;
</del><ins>+                                        &lt;span class=&quot;item-title&quot;&gt;&lt;?php echo esc_html( $title ); ?&gt; &lt;span class=&quot;is-submenu&quot; &lt;?php echo $submenu_text; ?&gt;&gt;&lt;?php _e( 'sub item' ); ?&gt;&lt;/span&gt;&lt;/span&gt;
</ins><span class="cx">                                         &lt;span class=&quot;item-controls&quot;&gt;
</span><span class="cx">                                                 &lt;span class=&quot;item-type&quot;&gt;&lt;?php echo esc_html( $item-&gt;type_label ); ?&gt;&lt;/span&gt;
</span><span class="cx">                                                 &lt;span class=&quot;item-order hide-if-js&quot;&gt;
</span><span class="lines">@@ -182,10 +186,10 @@
</span><span class="cx">                                                                 'action' =&gt; 'delete-menu-item',
</span><span class="cx">                                                                 'menu-item' =&gt; $item_id,
</span><span class="cx">                                                         ),
</span><del>-                                                        remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) )
</del><ins>+                                                        admin_url( 'nav-menus.php' )
</ins><span class="cx">                                                 ),
</span><span class="cx">                                                 'delete-menu_item_' . $item_id
</span><del>-                                        ); ?&gt;&quot;&gt;&lt;?php _e('Remove'); ?&gt;&lt;/a&gt; &lt;span class=&quot;meta-sep&quot;&gt; | &lt;/span&gt; &lt;a class=&quot;item-cancel submitcancel&quot; id=&quot;cancel-&lt;?php echo $item_id; ?&gt;&quot; href=&quot;&lt;?php        echo esc_url( add_query_arg( array('edit-menu-item' =&gt; $item_id, 'cancel' =&gt; time()), remove_query_arg( $removed_args, admin_url( 'nav-menus.php' ) ) ) );
</del><ins>+                                        ); ?&gt;&quot;&gt;&lt;?php _e( 'Remove' ); ?&gt;&lt;/a&gt; &lt;span class=&quot;meta-sep hide-if-no-js&quot;&gt; | &lt;/span&gt; &lt;a class=&quot;item-cancel submitcancel hide-if-no-js&quot; id=&quot;cancel-&lt;?php echo $item_id; ?&gt;&quot; href=&quot;&lt;?php echo esc_url( add_query_arg( array( 'edit-menu-item' =&gt; $item_id, 'cancel' =&gt; time() ), admin_url( 'nav-menus.php' ) ) );
</ins><span class="cx">                                                 ?&gt;#menu-item-settings-&lt;?php echo $item_id; ?&gt;&quot;&gt;&lt;?php _e('Cancel'); ?&gt;&lt;/a&gt;
</span><span class="cx">                                 &lt;/div&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -382,10 +386,8 @@
</span><span class="cx">  **/
</span><span class="cx"> function wp_nav_menu_setup() {
</span><span class="cx">         // Register meta boxes
</span><del>-        if ( wp_get_nav_menus() )
-                add_meta_box( 'nav-menu-theme-locations', __( 'Theme Locations' ), 'wp_nav_menu_locations_meta_box' , 'nav-menus', 'side', 'default' );
-        add_meta_box( 'add-custom-links', __('Custom Links'), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
</del><span class="cx">         wp_nav_menu_post_type_meta_boxes();
</span><ins>+        add_meta_box( 'add-custom-links', __( 'Add Links' ), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
</ins><span class="cx">         wp_nav_menu_taxonomy_meta_boxes();
</span><span class="cx"> 
</span><span class="cx">         // Register advanced menu items (columns)
</span><span class="lines">@@ -411,7 +413,7 @@
</span><span class="cx">         if ( get_user_option( 'metaboxhidden_nav-menus' ) !== false || ! is_array($wp_meta_boxes) )
</span><span class="cx">                 return;
</span><span class="cx"> 
</span><del>-        $initial_meta_boxes = array( 'nav-menu-theme-locations', 'add-custom-links', 'add-page', 'add-category' );
</del><ins>+        $initial_meta_boxes = array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category' );
</ins><span class="cx">         $hidden_meta_boxes = array();
</span><span class="cx"> 
</span><span class="cx">         foreach ( array_keys($wp_meta_boxes['nav-menus']) as $context ) {
</span><span class="lines">@@ -489,7 +491,7 @@
</span><span class="cx">         $menu_locations = get_nav_menu_locations();
</span><span class="cx">         $num_locations = count( array_keys($locations) );
</span><span class="cx"> 
</span><del>-        echo '&lt;p class=&quot;howto&quot;&gt;' . sprintf( _n('Your theme supports %s menu. Select which menu you would like to use.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations ), number_format_i18n($num_locations) ) . '&lt;/p&gt;';
</del><ins>+        echo '&lt;p class=&quot;howto&quot;&gt;' . _n( 'Select a menu to use within your theme.', 'Select the menus you will use in your theme.', $num_locations ) . '&lt;/p&gt;';
</ins><span class="cx"> 
</span><span class="cx">         foreach ( $locations as $location =&gt; $description ) {
</span><span class="cx">                 ?&gt;
</span><span class="lines">@@ -512,13 +514,33 @@
</span><span class="cx">         }
</span><span class="cx">         ?&gt;
</span><span class="cx">         &lt;p class=&quot;button-controls&quot;&gt;
</span><del>-                &lt;?php submit_button( __( 'Save' ), 'primary right', 'nav-menu-locations', false, disabled( $nav_menu_selected_id, 0, false ) ); ?&gt;
</del><ins>+                &lt;?php submit_button( __( 'Save' ), 'primary right', 'nav-menu-locations', false, wp_nav_menu_disabled_check( $nav_menu_selected_id ) ); ?&gt;
</ins><span class="cx">                 &lt;span class=&quot;spinner&quot;&gt;&lt;/span&gt;
</span><span class="cx">         &lt;/p&gt;
</span><span class="cx">         &lt;?php
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * Check whether to disable the Menu Locations meta box submit button
+ *
+ * @since 3.6.0
+ *
+ * @uses global $one_theme_location_no_menus to determine if no menus exist
+ * @uses disabled() to output the disabled attribute in $other_attributes param in submit_button()
+ *
+ * @param int|string $nav_menu_selected_id (id, name or slug) of the currently-selected menu
+ * @return string Disabled attribute if at least one menu exists, false if not
+*/
+function wp_nav_menu_disabled_check( $nav_menu_selected_id ) {
+        global $one_theme_location_no_menus;
+
+        if ( $one_theme_location_no_menus )
+                return false;
+
+        return disabled( $nav_menu_selected_id, 0 );
+}
+
+/**
</ins><span class="cx">  * Displays a metabox for the custom links menu item.
</span><span class="cx">  *
</span><span class="cx">  * @since 3.0.0
</span><span class="lines">@@ -554,14 +576,14 @@
</span><span class="cx"> 
</span><span class="cx">                         &lt;p id=&quot;menu-item-name-wrap&quot;&gt;
</span><span class="cx">                                 &lt;label class=&quot;howto&quot; for=&quot;custom-menu-item-name&quot;&gt;
</span><del>-                                        &lt;span&gt;&lt;?php _e('Label'); ?&gt;&lt;/span&gt;
</del><ins>+                                        &lt;span&gt;&lt;?php _e( 'Link Text' ); ?&gt;&lt;/span&gt;
</ins><span class="cx">                                         &lt;input id=&quot;custom-menu-item-name&quot; name=&quot;menu-item[&lt;?php echo $_nav_menu_placeholder; ?&gt;][menu-item-title]&quot; type=&quot;text&quot; class=&quot;regular-text menu-item-textbox input-with-default-title&quot; title=&quot;&lt;?php esc_attr_e('Menu Item'); ?&gt;&quot; /&gt;
</span><span class="cx">                                 &lt;/label&gt;
</span><span class="cx">                         &lt;/p&gt;
</span><span class="cx"> 
</span><span class="cx">                 &lt;p class=&quot;button-controls&quot;&gt;
</span><span class="cx">                         &lt;span class=&quot;add-to-menu&quot;&gt;
</span><del>-                                &lt;input type=&quot;submit&quot;&lt;?php disabled( $nav_menu_selected_id, 0 ); ?&gt; class=&quot;button-secondary submit-add-to-menu right&quot; value=&quot;&lt;?php esc_attr_e('Add to Menu'); ?&gt;&quot; name=&quot;add-custom-menu-item&quot; id=&quot;submit-customlinkdiv&quot; /&gt;
</del><ins>+                                &lt;input type=&quot;submit&quot;&lt;?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?&gt; class=&quot;button-secondary submit-add-to-menu right&quot; value=&quot;&lt;?php esc_attr_e('Add to Menu'); ?&gt;&quot; name=&quot;add-custom-menu-item&quot; id=&quot;submit-customlinkdiv&quot; /&gt;
</ins><span class="cx">                                 &lt;span class=&quot;spinner&quot;&gt;&lt;/span&gt;
</span><span class="cx">                         &lt;/span&gt;
</span><span class="cx">                 &lt;/p&gt;
</span><span class="lines">@@ -768,18 +790,18 @@
</span><span class="cx">                 &lt;p class=&quot;button-controls&quot;&gt;
</span><span class="cx">                         &lt;span class=&quot;list-controls&quot;&gt;
</span><span class="cx">                                 &lt;a href=&quot;&lt;?php
</span><del>-                                        echo esc_url(add_query_arg(
</del><ins>+                                        echo esc_url( add_query_arg(
</ins><span class="cx">                                                 array(
</span><span class="cx">                                                         $post_type_name . '-tab' =&gt; 'all',
</span><span class="cx">                                                         'selectall' =&gt; 1,
</span><span class="cx">                                                 ),
</span><del>-                                                remove_query_arg($removed_args)
</del><ins>+                                                remove_query_arg( $removed_args )
</ins><span class="cx">                                         ));
</span><span class="cx">                                 ?&gt;#posttype-&lt;?php echo $post_type_name; ?&gt;&quot; class=&quot;select-all&quot;&gt;&lt;?php _e('Select All'); ?&gt;&lt;/a&gt;
</span><span class="cx">                         &lt;/span&gt;
</span><span class="cx"> 
</span><span class="cx">                         &lt;span class=&quot;add-to-menu&quot;&gt;
</span><del>-                                &lt;input type=&quot;submit&quot;&lt;?php disabled( $nav_menu_selected_id, 0 ); ?&gt; class=&quot;button-secondary submit-add-to-menu right&quot; value=&quot;&lt;?php esc_attr_e('Add to Menu'); ?&gt;&quot; name=&quot;add-post-type-menu-item&quot; id=&quot;submit-posttype-&lt;?php echo $post_type_name; ?&gt;&quot; /&gt;
</del><ins>+                                &lt;input type=&quot;submit&quot;&lt;?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?&gt; class=&quot;button-secondary submit-add-to-menu right&quot; value=&quot;&lt;?php esc_attr_e( __( 'Add to Menu' ) ); ?&gt;&quot; name=&quot;add-post-type-menu-item&quot; id=&quot;&lt;?php esc_attr_e( 'submit-posttype-' . $post_type_name ); ?&gt;&quot; /&gt;
</ins><span class="cx">                                 &lt;span class=&quot;spinner&quot;&gt;&lt;/span&gt;
</span><span class="cx">                         &lt;/span&gt;
</span><span class="cx">                 &lt;/p&gt;
</span><span class="lines">@@ -955,7 +977,7 @@
</span><span class="cx">                         &lt;/span&gt;
</span><span class="cx"> 
</span><span class="cx">                         &lt;span class=&quot;add-to-menu&quot;&gt;
</span><del>-                                &lt;input type=&quot;submit&quot;&lt;?php disabled( $nav_menu_selected_id, 0 ); ?&gt; class=&quot;button-secondary submit-add-to-menu right&quot; value=&quot;&lt;?php esc_attr_e('Add to Menu'); ?&gt;&quot; name=&quot;add-taxonomy-menu-item&quot; id=&quot;submit-taxonomy-&lt;?php echo $taxonomy_name; ?&gt;&quot; /&gt;
</del><ins>+                                &lt;input type=&quot;submit&quot;&lt;?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?&gt; class=&quot;button-secondary submit-add-to-menu right&quot; value=&quot;&lt;?php esc_attr_e( __( 'Add to Menu' ) ); ?&gt;&quot; name=&quot;add-taxonomy-menu-item&quot; id=&quot;&lt;?php esc_attr_e( 'submit-taxonomy-' . $taxonomy_name ); ?&gt;&quot; /&gt;
</ins><span class="cx">                                 &lt;span class=&quot;spinner&quot;&gt;&lt;/span&gt;
</span><span class="cx">                         &lt;/span&gt;
</span><span class="cx">                 &lt;/p&gt;
</span><span class="lines">@@ -1086,7 +1108,7 @@
</span><span class="cx">                 $menu_items = wp_get_nav_menu_items( $menu-&gt;term_id, array('post_status' =&gt; 'any') );
</span><span class="cx">                 $result = '&lt;div id=&quot;menu-instructions&quot; class=&quot;post-body-plain';
</span><span class="cx">                 $result .= ( ! empty($menu_items) ) ? ' menu-instructions-inactive&quot;&gt;' : '&quot;&gt;';
</span><del>-                $result .= '&lt;p&gt;' . __('Select menu items (pages, categories, links) from the boxes at left to begin building your custom menu.') . '&lt;/p&gt;';
</del><ins>+                $result .= '&lt;p&gt;' . __( 'Next, add menu items (i.e. pages, links, categories) from the column on the left.' ) . '&lt;/p&gt;';
</ins><span class="cx">                 $result .= '&lt;/div&gt;';
</span><span class="cx"> 
</span><span class="cx">                 if( empty($menu_items) )
</span><span class="lines">@@ -1158,5 +1180,118 @@
</span><span class="cx">         foreach( (array) $menu_items_to_delete as $menu_item_id )
</span><span class="cx">                 wp_delete_post( $menu_item_id, true );
</span><span class="cx"> }
</span><ins>+add_action('admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items');
</ins><span class="cx"> 
</span><del>-add_action('admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items');
</del><ins>+/**
+ * Delete nav menus from the nav menu management screen
+ *
+ * @since 3.6.0
+ * @access private
+ *
+ * @param int|string $nav_menu_id The menu to delete (id, slug, or name)
+ * @return false if Error, otherwise true
+ */
+function _wp_delete_nav_menu( $nav_menu_id ) {
+
+        if ( ! is_nav_menu( $nav_menu_id ) )
+                return;
+
+        $deleted_nav_menu = wp_get_nav_menu_object( $nav_menu_id );
+        $delete_nav_menu = wp_delete_nav_menu( $nav_menu_id );
+
+        if ( is_wp_error( $delete_nav_menu ) )
+                return $delete_nav_menu;
+
+        // Remove this menu from any locations.
+        $locations = get_theme_mod( 'nav_menu_locations' );
+        foreach ( (array) $locations as $location =&gt; $menu_id ) {
+                if ( $menu_id == $nav_menu_id )
+                        $locations[ $location ] = 0;
+        }
+        set_theme_mod( 'nav_menu_locations', $locations );
+         return true;
+}
+
+/**
+ * Saves nav menu items
+ *
+ * @since 3.6.0
+ *
+ * @uses wp_get_nav_menu_items() to retrieve the nav menu's menu items
+ * @uses wp_defer_term_counter() to enable then disable term counting
+ *
+ * @param int|string $nav_menu_selected_id (id, slug, or name ) of the currently-selected menu
+ * @param string $nav_menu_selected_title Title of the currently-selected menu
+ * @return array $messages The menu updated message
+ */
+function wp_nav_menu_update_menu_items ( $nav_menu_selected_id, $nav_menu_selected_title ) {
+        $unsorted_menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array( 'orderby' =&gt; 'ID', 'output' =&gt; ARRAY_A, 'output_key' =&gt; 'ID', 'post_status' =&gt; 'draft,publish' ) );
+
+        $menu_items = array();
+        // Index menu items by db ID
+        foreach ( $unsorted_menu_items as $_item )
+                $menu_items[$_item-&gt;db_id] = $_item;
+
+        $post_fields = array(
+                'menu-item-db-id', 'menu-item-object-id', 'menu-item-object',
+                'menu-item-parent-id', 'menu-item-position', 'menu-item-type',
+                'menu-item-title', 'menu-item-url', 'menu-item-description',
+                'menu-item-attr-title', 'menu-item-target', 'menu-item-classes', 'menu-item-xfn'
+        );
+
+        wp_defer_term_counting( true );
+        // Loop through all the menu items' POST variables
+        if ( ! empty( $_POST['menu-item-db-id'] ) ) {
+                foreach( (array) $_POST['menu-item-db-id'] as $_key =&gt; $k ) {
+
+                        // Menu item title can't be blank
+                        if ( empty( $_POST['menu-item-title'][$_key] ) )
+                                continue;
+
+                        $args = array();
+                        foreach ( $post_fields as $field )
+                                $args[$field] = isset( $_POST[$field][$_key] ) ? $_POST[$field][$_key] : '';
+
+                        $menu_item_db_id = wp_update_nav_menu_item( $nav_menu_selected_id, ( $_POST['menu-item-db-id'][$_key] != $_key ? 0 : $_key ), $args );
+
+                        if ( is_wp_error( $menu_item_db_id ) )
+                                $messages[] = '&lt;div id=&quot;message&quot; class=&quot;error&quot;&gt;&lt;p&gt;' . $menu_item_db_id-&gt;get_error_message() . '&lt;/p&gt;&lt;/div&gt;';
+                        elseif ( isset( $menu_items[$menu_item_db_id] ) )
+                                unset( $menu_items[$menu_item_db_id] );
+                }
+        }
+
+        // Remove menu items from the menu that weren't in $_POST
+        if ( ! empty( $menu_items ) ) {
+                foreach ( array_keys( $menu_items ) as $menu_item_id ) {
+                        if ( is_nav_menu_item( $menu_item_id ) ) {
+                                wp_delete_post( $menu_item_id );
+                        }
+                }
+        }
+
+        // Store 'auto-add' pages.
+        $auto_add = ! empty( $_POST['auto-add-pages'] );
+        $nav_menu_option = (array) get_option( 'nav_menu_options' );
+        if ( ! isset( $nav_menu_option['auto_add'] ) )
+                $nav_menu_option['auto_add'] = array();
+        if ( $auto_add ) {
+                if ( ! in_array( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) )
+                        $nav_menu_option['auto_add'][] = $nav_menu_selected_id;
+        } else {
+                if ( false !== ( $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) ) )
+                        unset( $nav_menu_option['auto_add'][$key] );
+        }
+        // Remove nonexistent/deleted menus
+        $nav_menu_option['auto_add'] = array_intersect( $nav_menu_option['auto_add'], wp_get_nav_menus( array( 'fields' =&gt; 'ids' ) ) );
+        update_option( 'nav_menu_options', $nav_menu_option );
+
+        wp_defer_term_counting( false );
+
+        do_action( 'wp_update_nav_menu', $nav_menu_selected_id );
+
+        $messages[] = '&lt;div id=&quot;message&quot; class=&quot;updated&quot;&gt;&lt;p&gt;' . sprintf( __( '&lt;strong&gt;%1$s&lt;/strong&gt; has been updated.' ), $nav_menu_selected_title ) . '&lt;/p&gt;&lt;/div&gt;';
+        unset( $menu_items, $unsorted_menu_items );
+
+        return $messages;
+}
</ins></span></pre></div>
<a id="trunkwpadminjsnavmenujs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu.js (23440 => 23441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu.js        2013-02-16 03:59:37 UTC (rev 23440)
+++ trunk/wp-admin/js/nav-menu.js        2013-02-16 04:53:59 UTC (rev 23441)
</span><span class="lines">@@ -45,9 +45,14 @@
</span><span class="cx">                         if( api.menuList.length ) // If no menu, we're in the + tab.
</span><span class="cx">                                 this.initSortables();
</span><span class="cx"> 
</span><ins>+                        if( oneThemeLocationNoMenus )
+                                $( '#posttype-page' ).addSelectedToMenu( api.addMenuItemToBottom );
+
+                        this.messageFadeIn();
+
+                        this.initAccessibility();
+
</ins><span class="cx">                         this.initToggles();
</span><del>-
-                        this.initTabManager();
</del><span class="cx">                 },
</span><span class="cx"> 
</span><span class="cx">                 jQueryExtensions : function() {
</span><span class="lines">@@ -84,19 +89,55 @@
</span><span class="cx">                                         });
</span><span class="cx">                                         return result;
</span><span class="cx">                                 },
</span><ins>+                                shiftHorizontally : function( dir ) {
+                                        return this.each(function(){
+                                                var t = $(this),
+                                                        depth = t.menuItemDepth(),
+                                                        newDepth = depth + dir;
+
+                                                // Change .menu-item-depth-n class
+                                                t.moveHorizontally( newDepth, depth );
+                                        });
+                                },
+                                moveHorizontally : function( newDepth, depth ) {
+                                        return this.each(function(){
+                                                var t = $(this),
+                                                        children = t.childMenuItems(),
+                                                        diff = newDepth - depth,
+                                                        subItemText = t.find('.is-submenu');
+
+                                                // Change .menu-item-depth-n class
+                                                t.updateDepthClass( newDepth, depth ).updateParentMenuItemDBId();
+
+                                                // If it has children, move those too
+                                                if ( children ) {
+                                                        children.each(function( index ) {
+                                                                var t = $(this),
+                                                                        thisDepth = t.menuItemDepth(),
+                                                                        newDepth = thisDepth + diff;
+                                                                t.updateDepthClass(newDepth, thisDepth).updateParentMenuItemDBId();
+                                                        });
+                                                }
+
+                                                // Show &quot;Sub item&quot; helper text
+                                                if (0 === newDepth)
+                                                        subItemText.hide();
+                                                else
+                                                        subItemText.show();
+                                        });
+                                },
</ins><span class="cx">                                 updateParentMenuItemDBId : function() {
</span><span class="cx">                                         return this.each(function(){
</span><span class="cx">                                                 var item = $(this),
</span><del>-                                                        input = item.find('.menu-item-data-parent-id'),
-                                                        depth = item.menuItemDepth(),
-                                                        parent = item.prev();
</del><ins>+                                                        input = item.find( '.menu-item-data-parent-id' ),
+                                                        depth = parseInt( item.menuItemDepth() ),
+                                                        parentDepth = depth - 1,
+                                                        parent = item.prevAll( '.menu-item-depth-' + parentDepth ).first();
</ins><span class="cx"> 
</span><del>-                                                if( depth == 0 ) { // Item is on the top level, has no parent
</del><ins>+                                                if ( 0 == depth ) { // Item is on the top level, has no parent
</ins><span class="cx">                                                         input.val(0);
</span><span class="cx">                                                 } else { // Find the parent item, and retrieve its object id.
</span><del>-                                                        while( ! parent[0] || ! parent[0].className || -1 == parent[0].className.indexOf('menu-item') || ( parent.menuItemDepth() != depth - 1 ) )
-                                                                parent = parent.prev();
-                                                        input.val( parent.find('.menu-item-data-db-id').val() );
</del><ins>+                                                        input.val( parent.find( '.menu-item-data-db-id' ).val() );
</ins><span class="cx">                                                 }
</span><span class="cx">                                         });
</span><span class="cx">                                 },
</span><span class="lines">@@ -120,7 +161,7 @@
</span><span class="cx"> 
</span><span class="cx">                                         return this.each(function() {
</span><span class="cx">                                                 var t = $(this), menuItems = {},
</span><del>-                                                        checkboxes = t.find('.tabs-panel-active .categorychecklist li input:checked'),
</del><ins>+                                                        checkboxes = ( oneThemeLocationNoMenus &amp;&amp; 0 == t.find('.tabs-panel-active .categorychecklist li input:checked').length ) ? t.find('#page-all li input[type=&quot;checkbox&quot;]') : t.find('.tabs-panel-active .categorychecklist li input:checked'),
</ins><span class="cx">                                                         re = new RegExp('menu-item\\[(\[^\\]\]*)');
</span><span class="cx"> 
</span><span class="cx">                                                 processMethod = processMethod || api.addMenuItemToBottom;
</span><span class="lines">@@ -223,6 +264,128 @@
</span><span class="cx">                         });
</span><span class="cx">                 },
</span><span class="cx"> 
</span><ins>+                initAccessibility : function() {
+                        $( '.item-edit' ).off( 'focus' ).on( 'focus', function(){
+                                $(this).on( 'keydown', function(e){
+
+                                        var $this = $(this);
+
+                                        // Bail if it's not an arrow key
+                                        if ( 37 != e.which &amp;&amp; 38 != e.which &amp;&amp; 39 != e.which &amp;&amp; 40 != e.which )
+                                                return;
+
+                                        // Avoid multiple keydown events
+                                        $this.off('keydown');
+
+                                        var menuItems = $('#menu-to-edit li');
+                                                menuItemsCount = menuItems.length,
+                                                thisItem = $this.parents( 'li.menu-item' ),
+                                                thisItemChildren = thisItem.childMenuItems(),
+                                                thisItemData = thisItem.getItemData(),
+                                                thisItemDepth = parseInt( thisItem.menuItemDepth() ),
+                                                thisItemPosition = parseInt( thisItem.index() ),
+                                                nextItem = thisItem.next(),
+                                                nextItemChildren = nextItem.childMenuItems(),
+                                                nextItemDepth = parseInt( nextItem.menuItemDepth() ) + 1,
+                                                prevItem = thisItem.prev(),
+                                                prevItemDepth = parseInt( prevItem.menuItemDepth() ),
+                                                prevItemId = prevItem.getItemData()['menu-item-db-id'];
+
+                                        // Bail if there is only one menu item
+                                        if ( 1 === menuItemsCount )
+                                                return;
+
+                                        // If RTL, swap left/right arrows
+                                        var arrows = { '38' : 'up', '40' : 'down', '37' : 'left', '39' : 'right' };
+                                        if ( $('body').hasClass('rtl') )
+                                                arrows = { '38' : 'up', '40' : 'down', '39' : 'left', '37' : 'right' };
+
+                                        switch ( arrows[e.which] ) {
+                                        case 'up':
+                                                var newItemPosition = thisItemPosition - 1;
+
+                                                // Already at top
+                                                if ( 0 === thisItemPosition )
+                                                        break;
+
+                                                // If a sub item is moved to top, shift it to 0 depth
+                                                if ( 0 === newItemPosition &amp;&amp; 0 !== thisItemDepth )
+                                                        thisItem.moveHorizontally( 0, thisItemDepth );
+
+                                                // If prev item is sub item, shift to match depth
+                                                if ( 0 !== prevItemDepth )
+                                                        thisItem.moveHorizontally( prevItemDepth, thisItemDepth );
+
+                                                // Does this item have sub items?
+                                                if ( thisItemChildren ) {
+                                                        var items = thisItem.add( thisItemChildren );
+                                                        // Move the entire block
+                                                        items.detach().insertBefore( menuItems.eq( newItemPosition ) );
+                                                } else {
+                                                        thisItem.detach().insertBefore( menuItems.eq( newItemPosition ) );
+                                                }
+                                                break;
+                                        case 'down':
+                                                // Does this item have sub items?
+                                                if ( thisItemChildren ) {
+                                                        var items = thisItem.add( thisItemChildren ),
+                                                                nextItem = menuItems.eq( items.length + thisItemPosition ),
+                                                                nextItemChildren = 0 !== nextItem.childMenuItems().length;
+
+                                                        if ( nextItemChildren ) {
+                                                                var newDepth = parseInt( nextItem.menuItemDepth() ) + 1;
+                                                                thisItem.moveHorizontally( newDepth, thisItemDepth );
+                                                        }
+
+                                                        // Have we reached the bottom?
+                                                        if ( menuItemsCount === thisItemPosition + items.length )
+                                                                break;
+
+                                                        items.detach().insertAfter( menuItems.eq( thisItemPosition + items.length ) );
+                                                } else {
+                                                        // If next item has sub items, shift depth
+                                                        if ( 0 !== nextItemChildren.length )
+                                                                thisItem.moveHorizontally( nextItemDepth, thisItemDepth );
+
+                                                        // Have we reached the bottom
+                                                        if ( menuItemsCount === thisItemPosition + 1 )
+                                                                break;
+                                                        thisItem.detach().insertAfter( menuItems.eq( thisItemPosition + 1 ) );
+                                                }
+                                                break;
+                                        case 'left':
+                                                // As far left as possible
+                                                if ( 0 === thisItemDepth )
+                                                        break;
+                                                thisItem.shiftHorizontally( -1 );
+                                                break;
+                                        case 'right':
+                                                // Can't be sub item at top
+                                                if ( 0 === thisItemPosition )
+                                                        break;
+                                                // Already sub item of prevItem
+                                                if ( thisItemData['menu-item-parent-id'] === prevItemId )
+                                                        break;
+                                                thisItem.shiftHorizontally( 1 );
+                                                break;
+                                        }
+                                        api.registerChange();
+                                        // Put focus back on same menu item
+                                        $( '#edit-' + thisItemData['menu-item-db-id'] ).focus();
+                                        return false;
+                                });
+                        }).blur(function () {
+                                $(this).off( 'keydown' );
+                        });
+                },
+
+                messageFadeIn : function() {
+                        var messages = $( '#message' );
+
+                        // Visual change when users save menus multiple times in a row
+                        messages.slideDown( 'slow' );
+                },
+
</ins><span class="cx">                 initToggles : function() {
</span><span class="cx">                         // init postboxes
</span><span class="cx">                         postboxes.add_postbox_toggles('nav-menus');
</span><span class="lines">@@ -246,6 +409,9 @@
</span><span class="cx">                                 body = $('body'), maxChildDepth,
</span><span class="cx">                                 menuMaxDepth = initialMenuMaxDepth();
</span><span class="cx"> 
</span><ins>+                        if( 0 != $( '#menu-to-edit li' ).length )
+                                $( '.drag-instructions' ).show();
+
</ins><span class="cx">                         // Use the right edge if RTL.
</span><span class="cx">                         menuEdge += api.isRTL ? api.menuList.width() : 0;
</span><span class="cx"> 
</span><span class="lines">@@ -308,6 +474,13 @@
</span><span class="cx">                                         // Return child elements to the list
</span><span class="cx">                                         children = transport.children().insertAfter(ui.item);
</span><span class="cx"> 
</span><ins>+                                        // Add &quot;sub menu&quot; description
+                                        var subMenuTitle = ui.item.find( '.item-title .is-submenu' );
+                                        if ( 0 &lt; currentDepth )
+                                                subMenuTitle.show();
+                                        else
+                                                subMenuTitle.hide();
+
</ins><span class="cx">                                         // Update depth classes
</span><span class="cx">                                         if( depthChange != 0 ) {
</span><span class="cx">                                                 ui.item.updateDepthClass( currentDepth );
</span><span class="lines">@@ -327,9 +500,6 @@
</span><span class="cx">                                                 ui.item[0].style.left = 'auto';
</span><span class="cx">                                                 ui.item[0].style.right = 0;
</span><span class="cx">                                         }
</span><del>-
-                                        // The width of the tab bar might have changed. Just in case.
-                                        api.refreshMenuTabs( true );
</del><span class="cx">                                 },
</span><span class="cx">                                 change: function(e, ui) {
</span><span class="cx">                                         // Make sure the placeholder is inside the menu.
</span><span class="lines">@@ -461,6 +631,8 @@
</span><span class="cx">                                 if( '' == $t.val() )
</span><span class="cx">                                         $t.addClass( name ).val( $t.data(name) );
</span><span class="cx">                         });
</span><ins>+
+                        $( '.blank-slate .input-with-default-title' ).focus();
</ins><span class="cx">                 },
</span><span class="cx"> 
</span><span class="cx">                 attachThemeLocationsListeners : function() {
</span><span class="lines">@@ -572,8 +744,11 @@
</span><span class="cx">                         $.post( ajaxurl, params, function(menuMarkup) {
</span><span class="cx">                                 var ins = $('#menu-instructions');
</span><span class="cx">                                 processMethod(menuMarkup, params);
</span><del>-                                if( ! ins.hasClass('menu-instructions-inactive') &amp;&amp; ins.siblings().length )
-                                        ins.addClass('menu-instructions-inactive');
</del><ins>+                                // Make it stand out a bit more visually, by adding a fadeIn
+                                $( 'li.pending' ).hide().fadeIn('slow');
+                                $( '.drag-instructions' ).show();
+                                if( ! ins.hasClass( 'menu-instructions-inactive' ) &amp;&amp; ins.siblings().length )
+                                        ins.addClass( 'menu-instructions-inactive' );
</ins><span class="cx">                                 callback();
</span><span class="cx">                         });
</span><span class="cx">                 },
</span><span class="lines">@@ -586,10 +761,12 @@
</span><span class="cx">                  */
</span><span class="cx">                 addMenuItemToBottom : function( menuMarkup, req ) {
</span><span class="cx">                         $(menuMarkup).hideAdvancedMenuItemFields().appendTo( api.targetList );
</span><ins>+                        api.initAccessibility();
</ins><span class="cx">                 },
</span><span class="cx"> 
</span><span class="cx">                 addMenuItemToTop : function( menuMarkup, req ) {
</span><span class="cx">                         $(menuMarkup).hideAdvancedMenuItemFields().prependTo( api.targetList );
</span><ins>+                        api.initAccessibility();
</ins><span class="cx">                 },
</span><span class="cx"> 
</span><span class="cx">                 attachUnsavedChangesListener : function() {
</span><span class="lines">@@ -604,7 +781,7 @@
</span><span class="cx">                                 };
</span><span class="cx">                         } else {
</span><span class="cx">                                 // Make the post boxes read-only, as they can't be used yet
</span><del>-                                $('#menu-settings-column').find('input,select').prop('disabled', true).end().find('a').attr('href', '#').unbind('click');
</del><ins>+                                $( '#menu-settings-column' ).find( 'input,select' ).end().find( 'a' ).attr( 'href', '#' ).unbind( 'click' );
</ins><span class="cx">                         }
</span><span class="cx">                 },
</span><span class="cx"> 
</span><span class="lines">@@ -688,139 +865,6 @@
</span><span class="cx">                         });
</span><span class="cx">                 },
</span><span class="cx"> 
</span><del>-                initTabManager : function() {
-                        var fixed = $('.nav-tabs-wrapper'),
-                                fluid = fixed.children('.nav-tabs'),
-                                active = fluid.children('.nav-tab-active'),
-                                tabs = fluid.children('.nav-tab'),
-                                tabsWidth = 0,
-                                fixedRight, fixedLeft,
-                                arrowLeft, arrowRight, resizeTimer, css = {},
-                                marginFluid = api.isRTL ? 'margin-right' : 'margin-left',
-                                marginFixed = api.isRTL ? 'margin-left' : 'margin-right',
-                                msPerPx = 2;
-
-                        /**
-                         * Refreshes the menu tabs.
-                         * Will show and hide arrows where necessary.
-                         * Scrolls to the active tab by default.
-                         *
-                         * @param savePosition {boolean} Optional. Prevents scrolling so
-                         *                   that the current position is maintained. Default false.
-                         **/
-                        api.refreshMenuTabs = function( savePosition ) {
-                                var fixedWidth = fixed.width(),
-                                        margin = 0, css = {};
-                                fixedLeft = fixed.offset().left;
-                                fixedRight = fixedLeft + fixedWidth;
-
-                                if( !savePosition )
-                                        active.makeTabVisible();
-
-                                // Prevent space from building up next to the last tab if there's more to show
-                                if( tabs.last().isTabVisible() ) {
-                                        margin = fixed.width() - tabsWidth;
-                                        margin = margin &gt; 0 ? 0 : margin;
-                                        css[marginFluid] = margin + 'px';
-                                        fluid.animate( css, 100, &quot;linear&quot; );
-                                }
-
-                                // Show the arrows only when necessary
-                                if( fixedWidth &gt; tabsWidth )
-                                        arrowLeft.add( arrowRight ).hide();
-                                else
-                                        arrowLeft.add( arrowRight ).show();
-                        }
-
-                        $.fn.extend({
-                                makeTabVisible : function() {
-                                        var t = this.eq(0), left, right, css = {}, shift = 0;
-
-                                        if( ! t.length ) return this;
-
-                                        left = t.offset().left;
-                                        right = left + t.outerWidth();
-
-                                        if( right &gt; fixedRight )
-                                                shift = fixedRight - right;
-                                        else if ( left &lt; fixedLeft )
-                                                shift = fixedLeft - left;
-
-                                        if( ! shift ) return this;
-
-                                        css[marginFluid] = &quot;+=&quot; + api.negateIfRTL * shift + 'px';
-                                        fluid.animate( css, Math.abs( shift ) * msPerPx, &quot;linear&quot; );
-                                        return this;
-                                },
-                                isTabVisible : function() {
-                                        var t = this.eq(0),
-                                                left = t.offset().left,
-                                                right = left + t.outerWidth();
-                                        return ( right &lt;= fixedRight &amp;&amp; left &gt;= fixedLeft ) ? true : false;
-                                }
-                        });
-
-                        // Find the width of all tabs
-                        tabs.each(function(){
-                                tabsWidth += $(this).outerWidth(true);
-                        });
-
-                        // Set up fixed margin for overflow, unset padding
-                        css['padding'] = 0;
-                        css[marginFixed] = (-1 * tabsWidth) + 'px';
-                        fluid.css( css );
-
-                        // Build tab navigation
-                        arrowLeft = $('&lt;div class=&quot;nav-tabs-arrow nav-tabs-arrow-left&quot;&gt;&lt;a&gt;&amp;laquo;&lt;/a&gt;&lt;/div&gt;');
-                        arrowRight = $('&lt;div class=&quot;nav-tabs-arrow nav-tabs-arrow-right&quot;&gt;&lt;a&gt;&amp;raquo;&lt;/a&gt;&lt;/div&gt;');
-                        // Attach to the document
-                        fixed.wrap('&lt;div class=&quot;nav-tabs-nav&quot;/&gt;').parent().prepend( arrowLeft ).append( arrowRight );
-
-                        // Set the menu tabs
-                        api.refreshMenuTabs();
-                        // Make sure the tabs reset on resize
-                        $(window).resize(function() {
-                                if( resizeTimer ) clearTimeout(resizeTimer);
-                                resizeTimer = setTimeout( api.refreshMenuTabs, 200);
-                        });
-
-                        // Build arrow functions
-                        $.each([{
-                                        arrow : arrowLeft,
-                                        next : &quot;next&quot;,
-                                        last : &quot;first&quot;,
-                                        operator : &quot;+=&quot;
-                                },{
-                                        arrow : arrowRight,
-                                        next : &quot;prev&quot;,
-                                        last : &quot;last&quot;,
-                                        operator : &quot;-=&quot;
-                                }], function(){
-                                var that = this;
-                                this.arrow.mousedown(function(){
-                                        var marginFluidVal = Math.abs( parseInt( fluid.css(marginFluid) ) ),
-                                                shift = marginFluidVal,
-                                                css = {};
-
-                                        if( &quot;-=&quot; == that.operator )
-                                                shift = Math.abs( tabsWidth - fixed.width() ) - marginFluidVal;
-
-                                        if( ! shift ) return;
-
-                                        css[marginFluid] = that.operator + shift + 'px';
-                                        fluid.animate( css, shift * msPerPx, &quot;linear&quot; );
-                                }).mouseup(function(){
-                                        var tab, next;
-                                        fluid.stop(true);
-                                        tab = tabs[that.last]();
-                                        while( (next = tab[that.next]()) &amp;&amp; next.length &amp;&amp; ! next.isTabVisible() ) {
-                                                tab = next;
-                                        }
-                                        tab.makeTabVisible();
-                                });
-                        });
-                },
-
</del><span class="cx">                 eventOnClickEditLink : function(clickedEl) {
</span><span class="cx">                         var settings, item,
</span><span class="cx">                         matchedSection = /#(.*)$/.exec(clickedEl.href);
</span><span class="lines">@@ -846,8 +890,10 @@
</span><span class="cx">                 },
</span><span class="cx"> 
</span><span class="cx">                 eventOnClickCancelLink : function(clickedEl) {
</span><del>-                        var settings = $(clickedEl).closest('.menu-item-settings');
-                        settings.setItemData( settings.data('menu-item-data') );
</del><ins>+                        var settings = $( clickedEl ).closest( '.menu-item-settings' ),
+                                thisMenuItem = $( clickedEl ).closest( '.menu-item' );
+                        thisMenuItem.removeClass('menu-item-edit-active').addClass('menu-item-edit-inactive');
+                        settings.setItemData( settings.data('menu-item-data') ).hide();
</ins><span class="cx">                         return false;
</span><span class="cx">                 },
</span><span class="cx"> 
</span><span class="lines">@@ -944,9 +990,11 @@
</span><span class="cx">                                 }, 350, function() {
</span><span class="cx">                                         var ins = $('#menu-instructions');
</span><span class="cx">                                         el.remove();
</span><del>-                                        children.shiftDepthClass(-1).updateParentMenuItemDBId();
-                                        if( ! ins.siblings().length )
-                                                ins.removeClass('menu-instructions-inactive');
</del><ins>+                                        children.shiftDepthClass( -1 ).updateParentMenuItemDBId();
+                                        if( 0 == $( '#menu-to-edit li' ).length ) {
+                                                $( '.drag-instructions' ).hide();
+                                                ins.removeClass( 'menu-instructions-inactive' );
+                                        }
</ins><span class="cx">                                 });
</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 (23440 => 23441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/nav-menus.php        2013-02-16 03:59:37 UTC (rev 23440)
+++ trunk/wp-admin/nav-menus.php        2013-02-16 04:53:59 UTC (rev 23441)
</span><span class="lines">@@ -221,50 +221,65 @@
</span><span class="cx">                 if ( is_nav_menu_item( $menu_item_id ) &amp;&amp; wp_delete_post( $menu_item_id, true ) )
</span><span class="cx">                         $messages[] = '&lt;div id=&quot;message&quot; class=&quot;updated&quot;&gt;&lt;p&gt;' . __('The menu item has been successfully deleted.') . '&lt;/p&gt;&lt;/div&gt;';
</span><span class="cx">                 break;
</span><ins>+
</ins><span class="cx">         case 'delete':
</span><span class="cx">                 check_admin_referer( 'delete-nav_menu-' . $nav_menu_selected_id );
</span><del>-
</del><span class="cx">                 if ( is_nav_menu( $nav_menu_selected_id ) ) {
</span><del>-                        $deleted_nav_menu = wp_get_nav_menu_object( $nav_menu_selected_id );
-                        $delete_nav_menu = wp_delete_nav_menu( $nav_menu_selected_id );
-
-                        if ( is_wp_error($delete_nav_menu) ) {
-                                $messages[] = '&lt;div id=&quot;message&quot; class=&quot;error&quot;&gt;&lt;p&gt;' . $delete_nav_menu-&gt;get_error_message() . '&lt;/p&gt;&lt;/div&gt;';
-                        } else {
-                                // Remove this menu from any locations.
-                                $locations = get_theme_mod( 'nav_menu_locations' );
-                                foreach ( (array) $locations as $location =&gt; $menu_id ) {
-                                        if ( $menu_id == $nav_menu_selected_id )
-                                                $locations[ $location ] = 0;
-                                }
-                                set_theme_mod( 'nav_menu_locations', $locations );
-                                $messages[] = '&lt;div id=&quot;message&quot; class=&quot;updated&quot;&gt;&lt;p&gt;' . __('The menu has been successfully deleted.') . '&lt;/p&gt;&lt;/div&gt;';
-                                // Select the next available menu
-                                $nav_menu_selected_id = 0;
-                                $_nav_menus = wp_get_nav_menus( array('orderby' =&gt; 'name') );
-                                foreach( $_nav_menus as $index =&gt; $_nav_menu ) {
-                                        if ( strcmp( $_nav_menu-&gt;name, $deleted_nav_menu-&gt;name ) &gt;= 0
-                                         || $index == count( $_nav_menus ) - 1 ) {
-                                                $nav_menu_selected_id = $_nav_menu-&gt;term_id;
-                                                break;
-                                        }
-                                }
-                        }
-                        unset( $delete_nav_menu, $deleted_nav_menu, $_nav_menus );
</del><ins>+                        $deletion = _wp_delete_nav_menu( $nav_menu_selected_id );
</ins><span class="cx">                 } else {
</span><span class="cx">                         // Reset the selected menu
</span><span class="cx">                         $nav_menu_selected_id = 0;
</span><span class="cx">                         unset( $_REQUEST['menu'] );
</span><span class="cx">                 }
</span><ins>+
+                if ( ! isset( $deletion ) )
+                        break;
+
+                if ( is_wp_error( $deletion ) )
+                        $messages[] = '&lt;div id=&quot;message&quot; class=&quot;error&quot;&gt;&lt;p&gt;' . $deletion-&gt;get_error_message() . '&lt;/p&gt;&lt;/div&gt;';
+                else
+                        $messages[] = '&lt;div id=&quot;message&quot; class=&quot;updated&quot;&gt;&lt;p&gt;' . __( 'The menu has been successfully deleted.' ) . '&lt;/p&gt;&lt;/div&gt;';
</ins><span class="cx">                 break;
</span><span class="cx"> 
</span><ins>+        case 'delete_menus':
+                check_admin_referer( 'nav_menus_bulk_actions' );
+                foreach ( $_REQUEST['delete_menus'] as $menu_id_to_delete ) {
+                        if ( ! is_nav_menu( $menu_id_to_delete ) )
+                                continue;
+
+                        $deletion = _wp_delete_nav_menu( $menu_id_to_delete );
+                        if ( is_wp_error( $deletion ) ) {
+                                $messages[] = '&lt;div id=&quot;message&quot; class=&quot;error&quot;&gt;&lt;p&gt;' . $deletion-&gt;get_error_message() . '&lt;/p&gt;&lt;/div&gt;';
+                                $deletion_error = true;
+                        }
+                }
+
+                if ( empty( $deletion_error ) )
+                        $messages[] = '&lt;div id=&quot;message&quot; class=&quot;updated&quot;&gt;&lt;p&gt;' . __( 'Selected menus have been successfully deleted.' ) . '&lt;/p&gt;&lt;/div&gt;';
+                break;
+
</ins><span class="cx">         case 'update':
</span><span class="cx">                 check_admin_referer( 'update-nav_menu', 'update-nav-menu-nonce' );
</span><span class="cx"> 
</span><del>-                // Update menu theme locations
-                if ( isset( $_POST['menu-locations'] ) )
-                        set_theme_mod( 'nav_menu_locations', array_map( 'absint', $_POST['menu-locations'] ) );
</del><ins>+                // Get existing menu locations assignments
+                $locations = get_registered_nav_menus();
+                $menu_locations = get_nav_menu_locations();
</ins><span class="cx"> 
</span><ins>+                // Remove menu locations that have been unchecked
+                foreach ( $locations as $location =&gt; $description ) {
+                        if ( ( empty( $_POST['menu-locations'] ) || empty( $_POST['menu-locations'][ $location ] ) ) &amp;&amp; isset( $menu_locations[ $location ] ) &amp;&amp; $menu_locations[ $location ] == $nav_menu_selected_id )
+                                unset( $menu_locations[ $location ] );
+                }
+
+                // Merge new and existing menu locations if any new ones are set
+                if ( isset( $_POST['menu-locations'] ) ) {
+                        $new_menu_locations = array_map( 'absint', $_POST['menu-locations'] );
+                        $menu_locations = array_merge( $menu_locations, $new_menu_locations );
+                }
+
+                // Set menu locations
+                set_theme_mod( 'nav_menu_locations', $menu_locations );
+
</ins><span class="cx">                 // Add Menu
</span><span class="cx">                 if ( 0 == $nav_menu_selected_id ) {
</span><span class="cx">                         $new_menu_title = trim( esc_html( $_POST['menu-name'] ) );
</span><span class="lines">@@ -278,20 +293,33 @@
</span><span class="cx">                                         $_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id );
</span><span class="cx">                                         $nav_menu_selected_id = $_nav_menu_selected_id;
</span><span class="cx">                                         $nav_menu_selected_title = $_menu_object-&gt;name;
</span><del>-                                        $messages[] = '&lt;div id=&quot;message&quot; class=&quot;updated&quot;&gt;&lt;p&gt;' . sprintf( __('The &lt;strong&gt;%s&lt;/strong&gt; menu has been successfully created.'), $nav_menu_selected_title ) . '&lt;/p&gt;&lt;/div&gt;';
</del><ins>+                                        if ( isset( $_REQUEST['menu-item'] ) )
+                                                wp_save_nav_menu_items( $nav_menu_selected_id, absint( $_REQUEST['menu-item'] ) );
+                                        if ( isset( $_REQUEST['zero-menu-state'] ) ) {
+                                                // If there are menu items, add them
+                                                wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selected_title );
+                                                // Auto-save nav_menu_locations
+                                                $locations = get_theme_mod( 'nav_menu_locations' );
+                                                foreach ( (array) $locations as $location =&gt; $menu_id ) {
+                                                                $locations[ $location ] = $nav_menu_selected_id;
+                                                                break; // There should only be 1
+                                                }
+                                                set_theme_mod( 'nav_menu_locations', $locations );
+                                        }
+                                        $messages[] = '&lt;div id=&quot;message&quot; class=&quot;updated&quot;&gt;&lt;p&gt;' . sprintf( __( '&lt;strong&gt;%s&lt;/strong&gt; has been created.' ), $nav_menu_selected_title ) . '&lt;/p&gt;&lt;/div&gt;';
</ins><span class="cx">                                 }
</span><span class="cx">                         } else {
</span><del>-                                $messages[] = '&lt;div id=&quot;message&quot; class=&quot;error&quot;&gt;&lt;p&gt;' . __('Please enter a valid menu name.') . '&lt;/p&gt;&lt;/div&gt;';
</del><ins>+                                $messages[] = '&lt;div id=&quot;message&quot; class=&quot;error&quot;&gt;&lt;p&gt;' . __( 'Please enter a valid menu name.' ) . '&lt;/p&gt;&lt;/div&gt;';
</ins><span class="cx">                         }
</span><span class="cx"> 
</span><del>-                // update existing menu
</del><ins>+                // Update existing menu
</ins><span class="cx">                 } else {
</span><span class="cx"> 
</span><span class="cx">                         $_menu_object = wp_get_nav_menu_object( $nav_menu_selected_id );
</span><span class="cx"> 
</span><span class="cx">                         $menu_title = trim( esc_html( $_POST['menu-name'] ) );
</span><span class="cx">                         if ( ! $menu_title ) {
</span><del>-                                $messages[] = '&lt;div id=&quot;message&quot; class=&quot;error&quot;&gt;&lt;p&gt;' . __('Please enter a valid menu name.') . '&lt;/p&gt;&lt;/div&gt;';
</del><ins>+                                $messages[] = '&lt;div id=&quot;message&quot; class=&quot;error&quot;&gt;&lt;p&gt;' . __( 'Please enter a valid menu name.' ) . '&lt;/p&gt;&lt;/div&gt;';
</ins><span class="cx">                                 $menu_title = $_menu_object-&gt;name;
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="lines">@@ -307,68 +335,8 @@
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         // Update menu items
</span><del>-
</del><span class="cx">                         if ( ! is_wp_error( $_menu_object ) ) {
</span><del>-                                $unsorted_menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array('orderby' =&gt; 'ID', 'output' =&gt; ARRAY_A, 'output_key' =&gt; 'ID', 'post_status' =&gt; 'draft,publish') );
-                                $menu_items = array();
-                                // Index menu items by db ID
-                                foreach( $unsorted_menu_items as $_item )
-                                        $menu_items[$_item-&gt;db_id] = $_item;
-
-                                $post_fields = array( 'menu-item-db-id', 'menu-item-object-id', 'menu-item-object', 'menu-item-parent-id', 'menu-item-position', 'menu-item-type', 'menu-item-title', 'menu-item-url', 'menu-item-description', 'menu-item-attr-title', 'menu-item-target', 'menu-item-classes', 'menu-item-xfn' );
-                                wp_defer_term_counting(true);
-                                // Loop through all the menu items' POST variables
-                                if ( ! empty( $_POST['menu-item-db-id'] ) ) {
-                                        foreach( (array) $_POST['menu-item-db-id'] as $_key =&gt; $k ) {
-
-                                                // Menu item title can't be blank
-                                                if ( empty( $_POST['menu-item-title'][$_key] ) )
-                                                        continue;
-
-                                                $args = array();
-                                                foreach ( $post_fields as $field )
-                                                        $args[$field] = isset( $_POST[$field][$_key] ) ? $_POST[$field][$_key] : '';
-
-                                                $menu_item_db_id = wp_update_nav_menu_item( $nav_menu_selected_id, ( $_POST['menu-item-db-id'][$_key] != $_key ? 0 : $_key ), $args );
-
-                                                if ( is_wp_error( $menu_item_db_id ) )
-                                                        $messages[] = '&lt;div id=&quot;message&quot; class=&quot;error&quot;&gt;&lt;p&gt;' . $menu_item_db_id-&gt;get_error_message() . '&lt;/p&gt;&lt;/div&gt;';
-                                                elseif ( isset( $menu_items[$menu_item_db_id] ) )
-                                                        unset( $menu_items[$menu_item_db_id] );
-                                        }
-                                }
-
-                                // Remove menu items from the menu that weren't in $_POST
-                                if ( ! empty( $menu_items ) ) {
-                                        foreach ( array_keys( $menu_items ) as $menu_item_id ) {
-                                                if ( is_nav_menu_item( $menu_item_id ) ) {
-                                                        wp_delete_post( $menu_item_id );
-                                                }
-                                        }
-                                }
-
-                                // Store 'auto-add' pages.
-                                $auto_add = ! empty( $_POST['auto-add-pages'] );
-                                $nav_menu_option = (array) get_option( 'nav_menu_options' );
-                                if ( ! isset( $nav_menu_option['auto_add'] ) )
-                                        $nav_menu_option['auto_add'] = array();
-                                if ( $auto_add ) {
-                                        if ( ! in_array( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) )
-                                                $nav_menu_option['auto_add'][] = $nav_menu_selected_id;
-                                } else {
-                                        if ( false !== ( $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) ) )
-                                                unset( $nav_menu_option['auto_add'][$key] );
-                                }
-                                // Remove nonexistent/deleted menus
-                                $nav_menu_option['auto_add'] = array_intersect( $nav_menu_option['auto_add'], wp_get_nav_menus( array( 'fields' =&gt; 'ids' ) ) );
-                                update_option( 'nav_menu_options', $nav_menu_option );
-
-                                wp_defer_term_counting(false);
-
-                                do_action( 'wp_update_nav_menu', $nav_menu_selected_id );
-
-                                $messages[] = '&lt;div id=&quot;message&quot; class=&quot;updated&quot;&gt;&lt;p&gt;' . sprintf( __('The &lt;strong&gt;%s&lt;/strong&gt; menu has been updated.'), $nav_menu_selected_title ) . '&lt;/p&gt;&lt;/div&gt;';
-                                unset( $menu_items, $unsorted_menu_items );
</del><ins>+                                $messages = array_merge( $messages, wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selected_title ) );
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">                 break;
</span><span class="lines">@@ -376,23 +344,36 @@
</span><span class="cx"> 
</span><span class="cx"> // Get all nav menus
</span><span class="cx"> $nav_menus = wp_get_nav_menus( array('orderby' =&gt; 'name') );
</span><ins>+$menu_count = count( $nav_menus );
</ins><span class="cx"> 
</span><del>-// Get recently edited nav menu
-$recently_edited = (int) get_user_option( 'nav_menu_recently_edited' );
</del><ins>+// Are we on the add new screen?
+$add_new_screen = ( isset( $_GET['menu'] ) &amp;&amp; 0 == $_GET['menu'] ) ? true : false;
</ins><span class="cx"> 
</span><del>-// If there was no recently edited menu, and $nav_menu_selected_id is a nav menu, update recently edited menu.
-if ( !$recently_edited &amp;&amp; is_nav_menu( $nav_menu_selected_id ) ) {
</del><ins>+// If we have one theme location, and zero menus, we take them right into editing their first menu
+$page_count = wp_count_posts( 'page' );
+$one_theme_location_no_menus = ( 1 == count( get_registered_nav_menus() ) &amp;&amp; ! $add_new_screen &amp;&amp; empty( $nav_menus ) &amp;&amp; ! empty( $page_count-&gt;publish ) ) ? true : false;
+
+// Redirect to add screen if there are no menus and this users has either zero, or more than 1 theme locations
+if ( 0 == $menu_count &amp;&amp; ! $add_new_screen &amp;&amp; ! $one_theme_location_no_menus )
+        wp_redirect( admin_url( 'nav-menus.php?action=edit&amp;menu=0' ) );
+
+// Get recently edited nav menu
+$recently_edited = absint( get_user_option( 'nav_menu_recently_edited' ) );
+if ( empty( $recently_edited ) &amp;&amp; is_nav_menu( $nav_menu_selected_id ) )
</ins><span class="cx">         $recently_edited = $nav_menu_selected_id;
</span><span class="cx"> 
</span><del>-// Else if $nav_menu_selected_id is not a menu and not requesting that we create a new menu, but $recently_edited is a menu, grab that one.
-} elseif ( 0 == $nav_menu_selected_id &amp;&amp; ! isset( $_REQUEST['menu'] ) &amp;&amp; is_nav_menu( $recently_edited ) ) {
</del><ins>+// Use $recently_edited if none are selected
+if ( empty( $nav_menu_selected_id ) &amp;&amp; ! isset( $_GET['menu'] ) &amp;&amp; is_nav_menu( $recently_edited ) )
</ins><span class="cx">         $nav_menu_selected_id = $recently_edited;
</span><span class="cx"> 
</span><del>-// Else try to grab the first menu from the menus list
-} elseif ( 0 == $nav_menu_selected_id &amp;&amp; ! isset( $_REQUEST['menu'] ) &amp;&amp; ! empty($nav_menus) ) {
</del><ins>+// On deletion of menu, if another menu exists, show it
+if ( ! $add_new_screen &amp;&amp; 0 &lt; $menu_count &amp;&amp; isset( $_GET['action'] ) &amp;&amp; 'delete' == $_GET['action'] )
</ins><span class="cx">         $nav_menu_selected_id = $nav_menus[0]-&gt;term_id;
</span><del>-}
</del><span class="cx"> 
</span><ins>+// Set $nav_menu_selected_id to 0 if no menus
+if ( $one_theme_location_no_menus )
+        $nav_menu_selected_id = 0;
+
</ins><span class="cx"> // Update the user's setting
</span><span class="cx"> if ( $nav_menu_selected_id != $recently_edited &amp;&amp; is_nav_menu( $nav_menu_selected_id ) )
</span><span class="cx">         update_user_meta( $current_user-&gt;ID, 'nav_menu_recently_edited', $nav_menu_selected_id );
</span><span class="lines">@@ -412,14 +393,22 @@
</span><span class="cx">         $nav_menus[$key]-&gt;truncated_name = $_nav_menu-&gt;truncated_name;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+// Retrieve menu locations
+if ( current_theme_supports( 'menus' ) ) {
+        $locations = get_registered_nav_menus();
+        $menu_locations = get_nav_menu_locations();
+}
+
</ins><span class="cx"> // Ensure the user will be able to scroll horizontally
</span><span class="cx"> // by adding a class for the max menu depth.
</span><span class="cx"> global $_wp_nav_menu_max_depth;
</span><span class="cx"> $_wp_nav_menu_max_depth = 0;
</span><span class="cx"> 
</span><span class="cx"> // Calling wp_get_nav_menu_to_edit generates $_wp_nav_menu_max_depth
</span><del>-if ( is_nav_menu( $nav_menu_selected_id ) )
</del><ins>+if ( is_nav_menu( $nav_menu_selected_id ) ) {
+        $menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array( 'post_status' =&gt; 'any' ) );
</ins><span class="cx">         $edit_markup = wp_get_nav_menu_to_edit( $nav_menu_selected_id );
</span><ins>+}
</ins><span class="cx"> 
</span><span class="cx"> function wp_nav_menu_max_depth($classes) {
</span><span class="cx">         global $_wp_nav_menu_max_depth;
</span><span class="lines">@@ -460,15 +449,52 @@
</span><span class="cx"> ?&gt;
</span><span class="cx"> &lt;div class=&quot;wrap&quot;&gt;
</span><span class="cx">         &lt;?php screen_icon(); ?&gt;
</span><del>-        &lt;h2&gt;&lt;?php esc_html_e('Menus'); ?&gt;&lt;/h2&gt;
</del><ins>+        &lt;h2&gt;&lt;?php _e( 'Menus' ); ?&gt; &lt;a href=&quot;&lt;?php echo esc_url( add_query_arg( array( 'action' =&gt; 'edit', 'menu' =&gt; 0, ), admin_url( 'nav-menus.php' ) ) ); ?&gt;&quot; class=&quot;add-new-h2&quot;&gt;&lt;?php _e( 'Add New' ); ?&gt;&lt;/a&gt;&lt;/h2&gt;
</ins><span class="cx">         &lt;?php
</span><span class="cx">         foreach( $messages as $message ) :
</span><span class="cx">                 echo $message . &quot;\n&quot;;
</span><span class="cx">         endforeach;
</span><span class="cx">         ?&gt;
</span><ins>+        &lt;?php if ( 1 &lt; $menu_count ) : ?&gt;
+        &lt;form method=&quot;post&quot; action=&quot;&lt;?php echo admin_url( 'nav-menus.php' ); ?&gt;&quot;&gt;
+                &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;edit&quot; /&gt;
+                &lt;div class=&quot;manage-menus&quot;&gt;
+                        &lt;label for=&quot;menu&quot; class=&quot;selected-menu&quot;&gt;&lt;?php _e('Select menu to edit'); ?&gt;&lt;/label&gt;
+                        &lt;select name=&quot;menu&quot; id=&quot;menu&quot;&gt;
+                                &lt;?php if ( $add_new_screen ) : ?&gt;
+                                        &lt;option value=&quot;0&quot; selected=&quot;selected&quot;&gt;&lt;?php _e( '-- Select --' ); ?&gt;&lt;/option&gt;
+                                &lt;?php endif; ?&gt;
+                                &lt;?php foreach( (array) $nav_menus as $_nav_menu ) : ?&gt;
+                                        &lt;option value=&quot;&lt;?php echo esc_attr( $_nav_menu-&gt;term_id ); ?&gt;&quot; &lt;?php selected( $_nav_menu-&gt;term_id, $nav_menu_selected_id ); ?&gt;&gt;
+                                                &lt;?php
+                                                echo esc_html( $_nav_menu-&gt;truncated_name ) ;
+
+                                                if ( ! empty( $menu_locations ) &amp;&amp; in_array( $_nav_menu-&gt;term_id, $menu_locations ) ) {
+                                                        $locations_assigned_to_this_menu = array();
+                                                        foreach ( array_keys( $menu_locations, $_nav_menu-&gt;term_id ) as $menu_location_key ) {
+                                                                 $locations_assigned_to_this_menu[] = $locations[ $menu_location_key ];
+                                                        }
+                                                        $assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) ) );
+
+                                                        // Adds ellipses following the number of locations defined in $assigned_locations
+                                                        printf( ' (%1$s%2$s)',
+                                                                implode( ', ', $assigned_locations ),
+                                                                count( $locations_assigned_to_this_menu ) &gt; count( $assigned_locations ) ? ' &amp;hellip;' : ''
+                                                        );
+                                                }
+                                                ?&gt;
+                                        &lt;/option&gt;
+                                &lt;?php endforeach; ?&gt;
+                        &lt;/select&gt;
+                        &lt;span class=&quot;submit-btn&quot;&gt;&lt;input type=&quot;submit&quot; class=&quot;button-secondary&quot; value=&quot;&lt;?php _e( 'Select' ); ?&gt;&quot;&gt;&lt;/span&gt;
+                &lt;/div&gt;
+        &lt;/form&gt;
+        &lt;?php endif; ?&gt;
</ins><span class="cx">         &lt;div id=&quot;nav-menus-frame&quot;&gt;
</span><del>-        &lt;div id=&quot;menu-settings-column&quot; class=&quot;metabox-holder&lt;?php if ( !$nav_menu_selected_id ) { echo ' metabox-holder-disabled'; } ?&gt;&quot;&gt;
</del><ins>+        &lt;div id=&quot;menu-settings-column&quot; class=&quot;metabox-holder&lt;?php if ( isset( $_GET['menu'] ) &amp;&amp; '0' == $_GET['menu'] ) { echo ' metabox-holder-disabled'; } ?&gt;&quot;&gt;
</ins><span class="cx"> 
</span><ins>+                &lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
+
</ins><span class="cx">                 &lt;form id=&quot;nav-menu-meta&quot; action=&quot;&lt;?php echo admin_url( 'nav-menus.php' ); ?&gt;&quot; class=&quot;nav-menu-meta&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&gt;
</span><span class="cx">                         &lt;input type=&quot;hidden&quot; name=&quot;menu&quot; id=&quot;nav-menu-meta-object-id&quot; value=&quot;&lt;?php echo esc_attr( $nav_menu_selected_id ); ?&gt;&quot; /&gt;
</span><span class="cx">                         &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;add-menu-item&quot; /&gt;
</span><span class="lines">@@ -479,129 +505,100 @@
</span><span class="cx">         &lt;/div&gt;&lt;!-- /#menu-settings-column --&gt;
</span><span class="cx">         &lt;div id=&quot;menu-management-liquid&quot;&gt;
</span><span class="cx">                 &lt;div id=&quot;menu-management&quot;&gt;
</span><del>-                        &lt;div id=&quot;select-nav-menu-container&quot; class=&quot;hide-if-js&quot;&gt;
-                                &lt;form id=&quot;select-nav-menu&quot; action=&quot;&quot;&gt;
-                                        &lt;strong&gt;&lt;label for=&quot;select-nav-menu&quot;&gt;&lt;?php esc_html_e( 'Select Menu:' ); ?&gt;&lt;/label&gt;&lt;/strong&gt;
-                                        &lt;select class=&quot;select-nav-menu&quot; name=&quot;menu&quot;&gt;
-                                                &lt;?php foreach( (array) $nav_menus as $_nav_menu ) : ?&gt;
-                                                        &lt;option value=&quot;&lt;?php echo esc_attr($_nav_menu-&gt;term_id) ?&gt;&quot; &lt;?php selected($nav_menu_selected_id, $_nav_menu-&gt;term_id); ?&gt;&gt;
-                                                                &lt;?php echo esc_html( $_nav_menu-&gt;truncated_name ); ?&gt;
-                                                        &lt;/option&gt;
-                                                &lt;?php endforeach; ?&gt;
-                                                &lt;option value=&quot;0&quot;&gt;&lt;?php esc_html_e('Add New Menu'); ?&gt;&lt;/option&gt;
-                                        &lt;/select&gt;
-                                        &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;edit&quot; /&gt;
-                                        &lt;?php submit_button( __( 'Select' ), 'secondary', 'select_menu', false ); ?&gt;
-                                &lt;/form&gt;
-                        &lt;/div&gt;
-                        &lt;div class=&quot;nav-tabs-wrapper&quot;&gt;
-                        &lt;div class=&quot;nav-tabs&quot;&gt;
-                                &lt;?php
-                                foreach( (array) $nav_menus as $_nav_menu ) :
-                                        if ( $nav_menu_selected_id == $_nav_menu-&gt;term_id ) : ?&gt;&lt;span class=&quot;nav-tab nav-tab-active&quot;&gt;
-                                                        &lt;?php echo esc_html( $_nav_menu-&gt;truncated_name ); ?&gt;
-                                                &lt;/span&gt;&lt;?php else : ?&gt;&lt;a href=&quot;&lt;?php
-                                                        echo esc_url(add_query_arg(
-                                                                array(
-                                                                        'action' =&gt; 'edit',
-                                                                        'menu' =&gt; $_nav_menu-&gt;term_id,
-                                                                ),
-                                                                admin_url( 'nav-menus.php' )
-                                                        ));
-                                                ?&gt;&quot; class=&quot;nav-tab hide-if-no-js&quot;&gt;
-                                                        &lt;?php echo esc_html( $_nav_menu-&gt;truncated_name ); ?&gt;
-                                                &lt;/a&gt;&lt;?php endif;
-                                endforeach;
-                                if ( 0 == $nav_menu_selected_id ) : ?&gt;&lt;span class=&quot;nav-tab menu-add-new nav-tab-active&quot;&gt;
-                                        &lt;?php printf( '&lt;abbr title=&quot;%s&quot;&gt;+&lt;/abbr&gt;', esc_html__( 'Add menu' ) ); ?&gt;
-                                &lt;/span&gt;&lt;?php else : ?&gt;&lt;a href=&quot;&lt;?php
-                                        echo esc_url(add_query_arg(
-                                                array(
-                                                        'action' =&gt; 'edit',
-                                                        'menu' =&gt; 0,
-                                                ),
-                                                admin_url( 'nav-menus.php' )
-                                        ));
-                                ?&gt;&quot; class=&quot;nav-tab menu-add-new&quot;&gt;
-                                        &lt;?php printf( '&lt;abbr title=&quot;%s&quot;&gt;+&lt;/abbr&gt;', esc_html__( 'Add menu' ) ); ?&gt;
-                                &lt;/a&gt;&lt;?php endif; ?&gt;
-                        &lt;/div&gt;
-                        &lt;/div&gt;
-                        &lt;div class=&quot;menu-edit&quot;&gt;
-                                &lt;form id=&quot;update-nav-menu&quot; action=&quot;&lt;?php echo admin_url( 'nav-menus.php' ); ?&gt;&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&gt;
-                                        &lt;div id=&quot;nav-menu-header&quot;&gt;
-                                                &lt;div id=&quot;submitpost&quot; class=&quot;submitbox&quot;&gt;
-                                                        &lt;div class=&quot;major-publishing-actions&quot;&gt;
-                                                                &lt;label class=&quot;menu-name-label howto open-label&quot; for=&quot;menu-name&quot;&gt;
-                                                                        &lt;span&gt;&lt;?php _e('Menu Name'); ?&gt;&lt;/span&gt;
-                                                                        &lt;input name=&quot;menu-name&quot; id=&quot;menu-name&quot; type=&quot;text&quot; class=&quot;menu-name regular-text menu-item-textbox input-with-default-title&quot; title=&quot;&lt;?php esc_attr_e('Enter menu name here'); ?&gt;&quot; value=&quot;&lt;?php echo esc_attr( $nav_menu_selected_title ); ?&gt;&quot; /&gt;
-                                                                &lt;/label&gt;
-                                                                &lt;?php if ( !empty( $nav_menu_selected_id ) ) :
-                                                                        if ( ! isset( $auto_add ) ) {
-                                                                                $auto_add = get_option( 'nav_menu_options' );
-                                                                                if ( ! isset( $auto_add['auto_add'] ) )
-                                                                                        $auto_add = false;
-                                                                                elseif ( false !== array_search( $nav_menu_selected_id, $auto_add['auto_add'] ) )
-                                                                                        $auto_add = true;
-                                                                                else
-                                                                                        $auto_add = false;
-                                                                        }
-                                                                ?&gt;
-                                                                &lt;div class=&quot;auto-add-pages&quot;&gt;
-                                                                        &lt;label class=&quot;howto&quot;&gt;&lt;input type=&quot;checkbox&quot;&lt;?php checked( $auto_add ); ?&gt; name=&quot;auto-add-pages&quot; value=&quot;1&quot; /&gt; &lt;?php printf( __('Automatically add new top-level pages' ), esc_url( admin_url( 'edit.php?post_type=page' ) ) ); ?&gt;&lt;/label&gt;
-                                                                &lt;/div&gt;
-                                                                &lt;?php endif; ?&gt;
-                                                                &lt;br class=&quot;clear&quot; /&gt;
-                                                                &lt;div class=&quot;publishing-action&quot;&gt;
-                                                                        &lt;?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' =&gt; 'save_menu_header' ) ); ?&gt;
-                                                                &lt;/div&gt;&lt;!-- END .publishing-action --&gt;
</del><ins>+                        &lt;form id=&quot;update-nav-menu&quot; action=&quot;&lt;?php echo esc_url( admin_url( 'nav-menus.php' ) ); ?&gt;&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&gt;
+                                &lt;div class=&quot;menu-edit &lt;?php if ( $add_new_screen ) echo 'blank-slate'; ?&gt;&quot;&gt;
+                                        &lt;?php
+                                        wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
+                                        wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
+                                        wp_nonce_field( 'update-nav_menu', 'update-nav-menu-nonce' );
</ins><span class="cx"> 
</span><del>-                                                                &lt;?php if ( ! empty( $nav_menu_selected_id ) ) : ?&gt;
-                                                                &lt;div class=&quot;delete-action&quot;&gt;
-                                                                        &lt;a class=&quot;submitdelete deletion menu-delete&quot; href=&quot;&lt;?php echo esc_url( wp_nonce_url( admin_url('nav-menus.php?action=delete&amp;amp;menu=' . $nav_menu_selected_id), 'delete-nav_menu-' . $nav_menu_selected_id ) ); ?&gt;&quot;&gt;&lt;?php _e('Delete Menu'); ?&gt;&lt;/a&gt;
-                                                                &lt;/div&gt;&lt;!-- END .delete-action --&gt;
-                                                                &lt;?php endif; ?&gt;
-                                                        &lt;/div&gt;&lt;!-- END .major-publishing-actions --&gt;
-                                                &lt;/div&gt;&lt;!-- END #submitpost .submitbox --&gt;
-                                                &lt;?php
-                                                wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
-                                                wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
-                                                wp_nonce_field( 'update-nav_menu', 'update-nav-menu-nonce' );
-                                                ?&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;update&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;menu&quot; id=&quot;menu&quot; value=&quot;&lt;?php echo esc_attr( $nav_menu_selected_id ); ?&gt;&quot; /&gt;
-                                        &lt;/div&gt;&lt;!-- END #nav-menu-header --&gt;
</del><ins>+                                        if ( $one_theme_location_no_menus ) { ?&gt;
+                                                &lt;input type=&quot;hidden&quot; name=&quot;zero-menu-state&quot; value=&quot;true&quot; /&gt;
+                                        &lt;?php } ?&gt;
+                                         &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;update&quot; /&gt;
+                                        &lt;input type=&quot;hidden&quot; name=&quot;menu&quot; id=&quot;menu&quot; value=&quot;&lt;?php echo esc_attr( $nav_menu_selected_id ); ?&gt;&quot; /&gt;
+                                        &lt;div id=&quot;nav-menu-header&quot;&gt;
+                                                &lt;div class=&quot;major-publishing-actions&quot;&gt;
+                                                        &lt;label class=&quot;menu-name-label howto open-label&quot; for=&quot;menu-name&quot;&gt;
+                                                                &lt;span&gt;&lt;?php _e( 'Menu Name' ); ?&gt;&lt;/span&gt;
+                                                                &lt;input name=&quot;menu-name&quot; id=&quot;menu-name&quot; type=&quot;text&quot; class=&quot;menu-name regular-text menu-item-textbox input-with-default-title&quot; title=&quot;&lt;?php esc_attr_e( 'Enter menu name here' ); ?&gt;&quot; value=&quot;&lt;?php if ( $one_theme_location_no_menus ) _e( 'Menu 1' ); else echo esc_attr( $nav_menu_selected_title ); ?&gt;&quot; /&gt;
+                                                        &lt;/label&gt;
+                                                        &lt;div class=&quot;publishing-action&quot;&gt;
+                                                                &lt;?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' =&gt; 'save_menu_header' ) ); ?&gt;
+                                                        &lt;/div&gt;&lt;!-- END .publishing-action --&gt;
+                                                &lt;/div&gt;&lt;!-- END .major-publishing-actions --&gt;
+                                        &lt;/div&gt;&lt;!-- END .nav-menu-header --&gt;
</ins><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><ins>+                                                        &lt;?php if ( ! $add_new_screen ) : ?&gt;
+                                                        &lt;?php $starter_copy = ( $one_theme_location_no_menus ) ? __( 'Edit your default menu by adding or removing items. Drag each item into the order you prefer. Click Create Menu to save your changes.' ) : __( 'Drag each item into the order you prefer. Click an item to reveal additional configuration options.' ); ?&gt;
+                                                        &lt;div class=&quot;drag-instructions post-body-plain&quot; &lt;?php if ( isset( $menu_items ) &amp;&amp; 0 == count( $menu_items ) ) { ?&gt;style=&quot;display: none;&quot;&lt;?php } ?&gt;&gt;
+                                                                &lt;p&gt;&lt;?php echo $starter_copy; ?&gt;&lt;/p&gt;
+                                                        &lt;/div&gt;
</ins><span class="cx">                                                         &lt;?php
</span><del>-                                                        if ( isset( $edit_markup ) ) {
-                                                                if ( ! is_wp_error( $edit_markup ) )
-                                                                        echo $edit_markup;
-                                                        } else if ( empty( $nav_menu_selected_id ) ) {
-                                                                echo '&lt;div class=&quot;post-body-plain&quot;&gt;';
-                                                                echo '&lt;p&gt;' . __('To create a custom menu, give it a name above and click Create Menu. Then choose items like pages, categories or custom links from the left column to add to this menu.') . '&lt;/p&gt;';
-                                                                echo '&lt;p&gt;' . __('After you have added your items, drag and drop to put them in the order you want. You can also click each item to reveal additional configuration options.') . '&lt;/p&gt;';
-                                                                echo '&lt;p&gt;' . __('When you have finished building your custom menu, make sure you click the Save Menu button.') . '&lt;/p&gt;';
-                                                                echo '&lt;/div&gt;';
-                                                        }
</del><ins>+                                                        if ( isset( $edit_markup ) &amp;&amp; ! is_wp_error( $edit_markup ) ) {
+                                                                echo $edit_markup;
+                                                        } else {
</ins><span class="cx">                                                         ?&gt;
</span><ins>+                                                        &lt;ul class=&quot;menu&quot; id=&quot;menu-to-edit&quot;&gt;&lt;/ul&gt;
+                                                        &lt;?php } ?&gt;
+                                                        &lt;?php endif; ?&gt;
+                                                        &lt;?php if ( $add_new_screen ) : ?&gt;
+                                                                &lt;p class=&quot;post-body-plain&quot;&gt;&lt;?php _e( 'Give your menu a name above, then click Create Menu.' ); ?&gt;&lt;/p&gt;
+                                                        &lt;?php endif; ?&gt;
+                                                        &lt;div class=&quot;menu-settings&quot; &lt;?php if ( $one_theme_location_no_menus ) { ?&gt;style=&quot;display: none;&quot;&lt;?php } ?&gt;&gt;
+                                                                &lt;?php
+                                                                if ( ! isset( $auto_add ) ) {
+                                                                        $auto_add = get_option( 'nav_menu_options' );
+                                                                        if ( ! isset( $auto_add['auto_add'] ) )
+                                                                                $auto_add = false;
+                                                                        elseif ( false !== array_search( $nav_menu_selected_id, $auto_add['auto_add'] ) )
+                                                                                $auto_add = true;
+                                                                        else
+                                                                                $auto_add = false;
+                                                                } ?&gt;
+
+                                                                &lt;dl class=&quot;auto-add-pages&quot;&gt;
+                                                                        &lt;dt class=&quot;howto&quot;&gt;&lt;?php _e( 'Auto add pages' ); ?&gt;&lt;/dt&gt;
+                                                                        &lt;dd class=&quot;checkbox-input&quot;&gt;&lt;input type=&quot;checkbox&quot;&lt;?php checked( $auto_add ); ?&gt; name=&quot;auto-add-pages&quot; id=&quot;auto-add-pages&quot; value=&quot;1&quot; /&gt; &lt;label for=&quot;auto-add-pages&quot;&gt;&lt;?php printf( __('Automatically add new top-level pages to this menu' ), esc_url( admin_url( 'edit.php?post_type=page' ) ) ); ?&gt;&lt;/label&gt;&lt;/dd&gt;
+                                                                &lt;/dl&gt;
+
+                                                                &lt;?php if ( current_theme_supports( 'menus' ) ) : ?&gt;
+
+                                                                        &lt;dl class=&quot;menu-theme-locations&quot;&gt;
+                                                                                &lt;dt class=&quot;howto&quot;&gt;&lt;?php _e( 'Theme locations' ); ?&gt;&lt;/dt&gt;
+                                                                                &lt;?php foreach ( $locations as $location =&gt; $description ) : ?&gt;
+                                                                                &lt;dd class=&quot;checkbox-input&quot;&gt;
+                                                                                        &lt;input type=&quot;checkbox&quot;&lt;?php checked( isset( $menu_locations[ $location ] ) &amp;&amp; $menu_locations[ $location ] == $nav_menu_selected_id ); ?&gt; name=&quot;menu-locations[&lt;?php echo esc_attr( $location ); ?&gt;]&quot; id=&quot;locations-&lt;?php echo esc_attr( $location ); ?&gt;&quot; value=&quot;&lt;?php echo esc_attr( $nav_menu_selected_id ); ?&gt;&quot; /&gt; &lt;label for=&quot;locations-&lt;?php echo esc_attr( $location ); ?&gt;&quot;&gt;&lt;?php echo $description; ?&gt;&lt;/label&gt;
+                                                                                        &lt;?php if ( ! empty( $menu_locations[ $location ] ) &amp;&amp; $menu_locations[ $location ] != $nav_menu_selected_id ) : ?&gt;
+                                                                                        &lt;span class=&quot;theme-location-set&quot;&gt; &lt;?php printf( __( &quot;(Currently set to: %s)&quot; ), wp_get_nav_menu_object( $menu_locations[ $location ] )-&gt;name ); ?&gt; &lt;/span&gt;
+                                                                                        &lt;?php endif; ?&gt;
+                                                                                &lt;/dd&gt;
+                                                                                &lt;?php endforeach; ?&gt;
+                                                                        &lt;/dl&gt;
+
+                                                                &lt;?php endif; ?&gt;
+
+                                                        &lt;/div&gt;
</ins><span class="cx">                                                 &lt;/div&gt;&lt;!-- /#post-body-content --&gt;
</span><span class="cx">                                         &lt;/div&gt;&lt;!-- /#post-body --&gt;
</span><span class="cx">                                         &lt;div id=&quot;nav-menu-footer&quot;&gt;
</span><span class="cx">                                                 &lt;div class=&quot;major-publishing-actions&quot;&gt;
</span><del>-                                                &lt;div class=&quot;publishing-action&quot;&gt;
-                                                        &lt;?php
-                                                        if ( ! empty( $nav_menu_selected_id ) )
-                                                                submit_button( __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' =&gt; 'save_menu_footer' ) );
-                                                        ?&gt;
-                                                &lt;/div&gt;
-                                                &lt;/div&gt;
</del><ins>+                                                        &lt;?php if ( 0 != $menu_count &amp;&amp; ! $add_new_screen ) : ?&gt;
+                                                        &lt;span class=&quot;delete-action&quot;&gt;
+                                                                &lt;a class=&quot;submitdelete deletion menu-delete&quot; href=&quot;&lt;?php echo esc_url( wp_nonce_url( add_query_arg( array( 'action' =&gt; 'delete', 'menu' =&gt; $nav_menu_selected_id, admin_url() ) ), 'delete-nav_menu-' . $nav_menu_selected_id) ); ?&gt;&quot;&gt;&lt;?php _e('Delete Menu'); ?&gt;&lt;/a&gt;
+                                                        &lt;/span&gt;&lt;!-- END .delete-action --&gt;
+                                                        &lt;?php endif; ?&gt;
+                                                        &lt;div class=&quot;publishing-action&quot;&gt;
+                                                                &lt;?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' =&gt; 'save_menu_header' ) ); ?&gt;
+                                                        &lt;/div&gt;&lt;!-- END .publishing-action --&gt;
+                                                &lt;/div&gt;&lt;!-- END .major-publishing-actions --&gt;
</ins><span class="cx">                                         &lt;/div&gt;&lt;!-- /#nav-menu-footer --&gt;
</span><del>-                                &lt;/form&gt;&lt;!-- /#update-nav-menu --&gt;
-                        &lt;/div&gt;&lt;!-- /.menu-edit --&gt;
</del><ins>+                                &lt;/div&gt;&lt;!-- /.menu-edit --&gt;
+                        &lt;/form&gt;&lt;!-- /#update-nav-menu --&gt;
</ins><span class="cx">                 &lt;/div&gt;&lt;!-- /#menu-management --&gt;
</span><span class="cx">         &lt;/div&gt;&lt;!-- /#menu-management-liquid --&gt;
</span><span class="cx">         &lt;/div&gt;&lt;!-- /#nav-menus-frame --&gt;
</span><span class="cx"> &lt;/div&gt;&lt;!-- /.wrap--&gt;
</span><del>-
</del><ins>+&lt;script type=&quot;text/javascript&quot;&gt;var oneThemeLocationNoMenus = &lt;?php if ( $one_theme_location_no_menus ) echo 'true'; else echo 'false'; ?&gt;;&lt;/script&gt;
</ins><span class="cx"> &lt;?php include( './admin-footer.php' ); ?&gt;
</span></span></pre>
</div>
</div>

</body>
</html>