=f)?true:false}});l.each(function(){e+=b(this).outerWidth(true)});if(e<=h.width()-i.css("padding-left").slice(0,-2)-i.css("padding-right").slice(0,-2)){return}i.css({"margin-right":(-1*e)+"px",padding:0});k=b('');d=b('');h.wrap('').parent().prepend(k).append(d);c();b(window).resize(function(){if(j){return}j=true;setTimeout(function(){c();j=false},1000)});b.each([{arrow:k,next:"next",last:"first",operator:"+="},{arrow:d,next:"prev",last:"last",operator:"-="}],function(){var n=this;this.arrow.mousedown(function(){var p=l[n.last](),o=function(){if(!p.isTabVisible()){i.animate({"margin-left":n.operator+"90px"},300,"linear",o)}};o()}).mouseup(function(){var p,o;i.stop(true);p=l[n.last]();while((o=p[n.next]())&&o.length&&!o.isTabVisible()){p=o}p.makeTabVisible()})})},eventOnClickEditLink:function(c){var e,d=/#(.*)$/.exec(c.href);if(d&&d[1]){e=b("#"+d[1]);if(0!=e.length){if(e.hasClass("menu-item-edit-inactive")){e.slideDown("fast").siblings("dl").andSelf().removeClass("menu-item-edit-inactive").addClass("menu-item-edit-active")}else{e.slideUp("fast").siblings("dl").andSelf().removeClass("menu-item-edit-active").addClass("menu-item-edit-inactive")}return false}}},eventOnClickCloseLink:function(c){b(c).closest(".menu-item-settings").siblings("dl").find(".item-edit").click();return false},eventOnClickMenuSave:function(c){var d="";b("#nav-menu-theme-locations select").each(function(){d+=''});b("#update-nav-menu").append(d);a.menuList.find(".menu-item-data-position").val(function(e){return e+1});return true},eventOnClickMenuDelete:function(c){if(confirm(navMenuL10n.warnDeleteMenu)){return true}else{return false}},eventOnClickMenuItemDelete:function(c){var f,e,d=this;e=/_wpnonce=([a-zA-Z0-9]*)$/.exec(c.href);if(e&&e[1]){f=parseInt(c.id.replace("delete-",""),10);b.post(ajaxurl,{action:"delete-menu-item","menu-item":f,_wpnonce:e[1]},function(g){if("1"==g){d.removeMenuItem(document.getElementById("menu-item-"+f))}});return false}return true},processQuickSearchQueryResponse:function(g,m,c){var h,e,j,f={},d=document.getElementById("nav-menu-meta"),l=new RegExp("menu-item\\[([^\\]]*)","g"),k=g.match(/.*<\/li>/g);if(!k){b(".categorychecklist",c).html(""+navMenuL10n.noResultsFound+"
");b("img.waiting",c).hide();return}h=k.length;while(h--){e=l.exec(k[h]);if(e&&e[1]){j=e[1];while(d.elements["menu-item["+j+"][menu-item-type]"]||f[j]){j--}f[j]=true;if(j!=e[1]){k[h]=k[h].replace(new RegExp("menu-item\\["+e[1]+"\\]","g"),"menu-item["+j+"]")}}}b(".categorychecklist",c).html(k.join(""));b("img.waiting",c).hide()},removeMenuItem:function(d){d=b(d);var c=d.childMenuItems();d.addClass("deleting").fadeOut(350,function(){d.remove();c.shiftDepthClass(-1).updateParentMenuItemDBId()})},getListDataFromID:function(k,h){if(!k){return false}h=h||document;var d=["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"],c={},e=h.getElementsByTagName("input"),g=e.length,f;while(g--){f=d.length;while(f--){if(e[g]&&e[g].name&&"menu-item["+k+"]["+d[f]+"]"==e[g].name){c[d[f]]=e[g].value}}}return c},depthToPx:function(c){return c*a.options.menuItemDepthPerLevel},pxToDepth:function(c){return Math.floor(c/a.options.menuItemDepthPerLevel)}};b(document).ready(function(){wpNavMenu.init()})})(jQuery);
\ No newline at end of file
diff --git a/wp-admin/menu.php b/wp-admin/menu.php
index b436494c26..96d8ed0551 100644
--- a/wp-admin/menu.php
+++ b/wp-admin/menu.php
@@ -149,11 +149,13 @@ $menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' );
if ( current_user_can( 'switch_themes') ) {
$menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' );
$submenu['themes.php'][5] = array(__('Themes'), 'switch_themes', 'themes.php');
- $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php');
+ if ( current_theme_supports( 'nav-menus' ) || current_theme_supports( 'widgets' ) )
+ $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php');
} else {
$menu[60] = array( __('Appearance'), 'edit_theme_options', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' );
$submenu['themes.php'][5] = array(__('Themes'), 'edit_theme_options', 'themes.php');
- $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php' );
+ if ( current_theme_supports( 'nav-menus' ) || current_theme_supports( 'widgets' ) )
+ $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php' );
}
// Add 'Editor' to the bottom of the Appearence menu.
diff --git a/wp-admin/nav-menus.php b/wp-admin/nav-menus.php
index 41323f79f9..a7d245ac8d 100644
--- a/wp-admin/nav-menus.php
+++ b/wp-admin/nav-menus.php
@@ -15,6 +15,9 @@ require_once( 'admin.php' );
// Load all the nav menu interface functions
require_once( ABSPATH . 'wp-admin/includes/nav-menu.php' );
+if ( ! current_theme_supports( 'nav-menus' ) && ! current_theme_supports( 'widgets' ) )
+ wp_die( __( 'Your theme does not support navigation menus or widgets.' ) );
+
// Permissions Check
if ( ! current_user_can('edit_theme_options') )
wp_die( __( 'Cheatin’ uh?' ) );
@@ -270,28 +273,29 @@ switch ( $action ) {
case 'update':
check_admin_referer( 'update-nav_menu', 'update-nav-menu-nonce' );
+ // Update menu theme locations
+ set_theme_mod( 'nav_menu_locations', $_POST['menu-locations'] );
+
// Add Menu
if ( 0 == $nav_menu_selected_id ) {
- if ( current_theme_supports('nav-menus') || current_theme_supports('widgets') ) {
- $new_menu_title = esc_html( $_POST['menu-name'] );
+ $new_menu_title = esc_html( $_POST['menu-name'] );
- if ( $new_menu_title ) {
- $_nav_menu_selected_id = wp_update_nav_menu_object( 0, array('menu-name' => $new_menu_title) );
+ if ( $new_menu_title ) {
+ $_nav_menu_selected_id = wp_update_nav_menu_object( 0, array('menu-name' => $new_menu_title) );
- if ( is_wp_error( $_nav_menu_selected_id ) ) {
- $messages[] = '' . $_nav_menu_selected_id->get_error_message() . '
';
- } else {
- if ( ( $_menu_locations = get_registered_nav_menus() ) && 1 == count( wp_get_nav_menus() ) )
- set_theme_mod( 'nav_menu_locations', array( key( $_menu_locations ) => $_nav_menu_selected_id ) );
- unset( $_menu_locations );
- $_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id );
- $nav_menu_selected_id = $_nav_menu_selected_id;
- $nav_menu_selected_title = $_menu_object->name;
- $messages[] = '' . sprintf( __('The %s menu has been successfully created.'), $nav_menu_selected_title ) . '
';
- }
+ if ( is_wp_error( $_nav_menu_selected_id ) ) {
+ $messages[] = '' . $_nav_menu_selected_id->get_error_message() . '
';
} else {
- $messages[] = '' . __('Please enter a valid menu name.') . '
';
+ if ( ( $_menu_locations = get_registered_nav_menus() ) && 1 == count( wp_get_nav_menus() ) )
+ set_theme_mod( 'nav_menu_locations', array( key( $_menu_locations ) => $_nav_menu_selected_id ) );
+ unset( $_menu_locations );
+ $_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id );
+ $nav_menu_selected_id = $_nav_menu_selected_id;
+ $nav_menu_selected_title = $_menu_object->name;
+ $messages[] = '' . sprintf( __('The %s menu has been successfully created.'), $nav_menu_selected_title ) . '
';
}
+ } else {
+ $messages[] = '' . __('Please enter a valid menu name.') . '
';
}
// update existing menu
@@ -425,8 +429,6 @@ require_once( 'admin-header.php' );
echo $message . "\n";
endforeach;
?>
-
-
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index dfb793caf8..1d09cc798f 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -385,7 +385,7 @@ function wp_default_scripts( &$scripts ) {
) );
// Custom Navigation
- $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", false, '20100521' );
+ $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", false, '20100524' );
$scripts->localize( 'nav-menu', 'navMenuL10n', array(
'home' => _x('Home', 'nav menu home label'),
'homeurl' => home_url('/'),