Changeset 48051
- Timestamp:
- 06/15/2020 11:20:18 PM (4 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/nav-menus.css
r46309 r48051 64 64 #wpbody { 65 65 position: relative; 66 }67 68 .blank-slate .menu-settings {69 border: none;70 margin-top: 0;71 padding-top: 0;72 overflow: hidden;73 66 } 74 67 … … 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 { -
trunk/src/wp-admin/nav-menus.php
r47855 r48051 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'] ) ) { … … 313 306 $menu_locations = array_merge( $menu_locations, $new_menu_locations ); 314 307 } 315 316 // Set menu locations.317 set_theme_mod( 'nav_menu_locations', $menu_locations );318 308 319 309 // Add Menu. … … 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(); … … 360 359 } 361 360 362 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 ); … … 894 902 <div id="menu-management"> 895 903 <form id="update-nav-menu" method="post" enctype="multipart/form-data"> 896 <?php897 $new_screen_class = '';898 if ( $add_new_screen ) {899 $new_screen_class = 'blank-slate';900 }901 ?>902 904 <h2><?php _e( 'Menu structure' ); ?></h2> 903 <div class="menu-edit <?php echo $new_screen_class; ?>">905 <div class="menu-edit"> 904 906 <input type="hidden" name="nav-menu-data"> 905 907 <?php
Note: See TracChangeset
for help on using the changeset viewer.