diff --git a/src/wp-admin/css/nav-menus.css b/src/wp-admin/css/nav-menus.css
index 8b68ac5400..83907c6240 100644
|
a
|
b
|
ul.add-menu-item-tabs li { |
| 65 | 65 | position: relative; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | | .blank-slate .menu-settings { |
| 69 | | border: none; |
| 70 | | margin-top: 0; |
| 71 | | padding-top: 0; |
| 72 | | overflow: hidden; |
| 73 | | } |
| 74 | | |
| 75 | 68 | .is-submenu { |
| 76 | 69 | color: #555d66; /* #fafafa background */ |
| 77 | 70 | font-style: italic; |
| … |
… |
body.menu-max-depth-11 { min-width: 1280px !important; } |
| 749 | 742 | float: right; |
| 750 | 743 | } |
| 751 | 744 | |
| 752 | | .nav-menus-php .blank-slate .menu-settings { |
| 753 | | display: none; |
| 754 | | } |
| 755 | | |
| 756 | 745 | /* Same as the Publish Meta Box #delete-action */ |
| 757 | 746 | .nav-menus-php .delete-action { |
| 758 | 747 | float: left; |
diff --git a/src/wp-admin/nav-menus.php b/src/wp-admin/nav-menus.php
index 6f33cd7321..7bdc2db404 100644
|
a
|
b
|
switch ( $action ) { |
| 300 | 300 | case 'update': |
| 301 | 301 | check_admin_referer( 'update-nav_menu', 'update-nav-menu-nonce' ); |
| 302 | 302 | |
| 303 | | // Remove menu locations that have been unchecked. |
| 304 | | foreach ( $locations as $location => $description ) { |
| 305 | | if ( ( empty( $_POST['menu-locations'] ) || empty( $_POST['menu-locations'][ $location ] ) ) && isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $nav_menu_selected_id ) { |
| 306 | | unset( $menu_locations[ $location ] ); |
| 307 | | } |
| 308 | | } |
| 309 | | |
| 310 | 303 | // Merge new and existing menu locations if any new ones are set. |
| 311 | 304 | if ( isset( $_POST['menu-locations'] ) ) { |
| 312 | 305 | $new_menu_locations = array_map( 'absint', $_POST['menu-locations'] ); |
| 313 | 306 | $menu_locations = array_merge( $menu_locations, $new_menu_locations ); |
| 314 | 307 | } |
| 315 | 308 | |
| 316 | | // Set menu locations. |
| 317 | | set_theme_mod( 'nav_menu_locations', $menu_locations ); |
| 318 | | |
| 319 | 309 | // Add Menu. |
| 320 | 310 | if ( 0 == $nav_menu_selected_id ) { |
| 321 | 311 | $new_menu_title = trim( esc_html( $_POST['menu-name'] ) ); |
| … |
… |
switch ( $action ) { |
| 332 | 322 | if ( isset( $_REQUEST['menu-item'] ) ) { |
| 333 | 323 | wp_save_nav_menu_items( $nav_menu_selected_id, absint( $_REQUEST['menu-item'] ) ); |
| 334 | 324 | } |
| 335 | | if ( isset( $_REQUEST['zero-menu-state'] ) ) { |
| | 325 | // Set the menu_location value correctly for the newly created menu. |
| | 326 | foreach ( $menu_locations as $location => $id ) { |
| | 327 | if ( 0 === $id ) { |
| | 328 | $menu_locations[ $location ] = $nav_menu_selected_id; |
| | 329 | } |
| | 330 | } |
| | 331 | set_theme_mod( 'nav_menu_locations', $menu_locations ); |
| | 332 | if ( isset( $_REQUEST['zero-menu-state'] ) || ! empty( $_POST['auto-add-pages'] ) ) { |
| 336 | 333 | // If there are menu items, add them. |
| 337 | 334 | wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selected_title ); |
| | 335 | } |
| | 336 | if ( isset( $_REQUEST['zero-menu-state'] ) ) { |
| 338 | 337 | // Auto-save nav_menu_locations. |
| 339 | 338 | $locations = get_nav_menu_locations(); |
| 340 | 339 | foreach ( $locations as $location => $menu_id ) { |
| … |
… |
switch ( $action ) { |
| 359 | 358 | $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __( 'Please enter a valid menu name.' ) . '</p></div>'; |
| 360 | 359 | } |
| 361 | 360 | |
| 362 | | // Update existing menu. |
| | 361 | // Update existing menu. |
| 363 | 362 | } else { |
| | 363 | // Remove menu locations that have been unchecked. |
| | 364 | foreach ( $locations as $location => $description ) { |
| | 365 | if ( ( empty( $_POST['menu-locations'] ) || empty( $_POST['menu-locations'][ $location ] ) ) && isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $nav_menu_selected_id ) { |
| | 366 | unset( $menu_locations[ $location ] ); |
| | 367 | } |
| | 368 | } |
| | 369 | |
| | 370 | // Set menu locations. |
| | 371 | set_theme_mod( 'nav_menu_locations', $menu_locations ); |
| 364 | 372 | |
| 365 | 373 | $_menu_object = wp_get_nav_menu_object( $nav_menu_selected_id ); |
| 366 | 374 | |
| … |
… |
require_once ABSPATH . 'wp-admin/admin-header.php'; |
| 886 | 894 | <div id="menu-management-liquid"> |
| 887 | 895 | <div id="menu-management"> |
| 888 | 896 | <form id="update-nav-menu" method="post" enctype="multipart/form-data"> |
| 889 | | <?php |
| 890 | | $new_screen_class = ''; |
| 891 | | if ( $add_new_screen ) { |
| 892 | | $new_screen_class = 'blank-slate'; |
| 893 | | } |
| 894 | | ?> |
| 895 | 897 | <h2><?php _e( 'Menu structure' ); ?></h2> |
| 896 | | <div class="menu-edit <?php echo $new_screen_class; ?>"> |
| | 898 | <div class="menu-edit"> |
| 897 | 899 | <input type="hidden" name="nav-menu-data"> |
| 898 | 900 | <?php |
| 899 | 901 | wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); |