26 '<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>', |
26 '<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>', |
27 403 |
27 403 |
28 ); |
28 ); |
29 } |
29 } |
30 |
30 |
|
31 // Used in the HTML title tag. |
|
32 $title = __( 'Menus' ); |
|
33 |
31 wp_enqueue_script( 'nav-menu' ); |
34 wp_enqueue_script( 'nav-menu' ); |
32 |
35 |
33 if ( wp_is_mobile() ) { |
36 if ( wp_is_mobile() ) { |
34 wp_enqueue_script( 'jquery-touch-punch' ); |
37 wp_enqueue_script( 'jquery-touch-punch' ); |
35 } |
38 } |
115 $parent_object = wp_setup_nav_menu_item( get_post( $parent_db_id ) ); |
118 $parent_object = wp_setup_nav_menu_item( get_post( $parent_db_id ) ); |
116 |
119 |
117 if ( ! is_wp_error( $parent_object ) ) { |
120 if ( ! is_wp_error( $parent_object ) ) { |
118 $parent_data = (array) $parent_object; |
121 $parent_data = (array) $parent_object; |
119 $menu_item_data['menu_item_parent'] = $parent_data['menu_item_parent']; |
122 $menu_item_data['menu_item_parent'] = $parent_data['menu_item_parent']; |
|
123 |
|
124 // Reset invalid `menu_item_parent`. |
|
125 $menu_item_data = _wp_reset_invalid_menu_item_parent( $menu_item_data ); |
|
126 |
120 update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); |
127 update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); |
121 } |
128 } |
122 |
129 |
123 // Make menu item a child of its next sibling. |
130 // Make menu item a child of its next sibling. |
124 } else { |
131 } else { |
125 $next_item_data['menu_order'] = $next_item_data['menu_order'] - 1; |
132 $next_item_data['menu_order'] = $next_item_data['menu_order'] - 1; |
126 $menu_item_data['menu_order'] = $menu_item_data['menu_order'] + 1; |
133 $menu_item_data['menu_order'] = $menu_item_data['menu_order'] + 1; |
127 |
134 |
128 $menu_item_data['menu_item_parent'] = $next_item_data['ID']; |
135 $menu_item_data['menu_item_parent'] = $next_item_data['ID']; |
|
136 |
|
137 // Reset invalid `menu_item_parent`. |
|
138 $menu_item_data = _wp_reset_invalid_menu_item_parent( $menu_item_data ); |
|
139 |
129 update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); |
140 update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); |
130 |
141 |
131 wp_update_post( $menu_item_data ); |
142 wp_update_post( $menu_item_data ); |
132 wp_update_post( $next_item_data ); |
143 wp_update_post( $next_item_data ); |
133 } |
144 } |
135 // The item is last but still has a parent, so bubble up. |
146 // The item is last but still has a parent, so bubble up. |
136 } elseif ( ! empty( $menu_item_data['menu_item_parent'] ) |
147 } elseif ( ! empty( $menu_item_data['menu_item_parent'] ) |
137 && in_array( (int) $menu_item_data['menu_item_parent'], $orders_to_dbids, true ) |
148 && in_array( (int) $menu_item_data['menu_item_parent'], $orders_to_dbids, true ) |
138 ) { |
149 ) { |
139 $menu_item_data['menu_item_parent'] = (int) get_post_meta( $menu_item_data['menu_item_parent'], '_menu_item_menu_item_parent', true ); |
150 $menu_item_data['menu_item_parent'] = (int) get_post_meta( $menu_item_data['menu_item_parent'], '_menu_item_menu_item_parent', true ); |
|
151 |
|
152 // Reset invalid `menu_item_parent`. |
|
153 $menu_item_data = _wp_reset_invalid_menu_item_parent( $menu_item_data ); |
|
154 |
140 update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); |
155 update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); |
141 } |
156 } |
142 } |
157 } |
143 } |
158 } |
144 |
159 |
245 || empty( $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] ) |
260 || empty( $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] ) |
246 || $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] !== (int) $menu_item_data['menu_item_parent'] |
261 || $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] !== (int) $menu_item_data['menu_item_parent'] |
247 ) { |
262 ) { |
248 // Just make it a child of the previous; keep the order. |
263 // Just make it a child of the previous; keep the order. |
249 $menu_item_data['menu_item_parent'] = (int) $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ]; |
264 $menu_item_data['menu_item_parent'] = (int) $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ]; |
|
265 |
|
266 // Reset invalid `menu_item_parent`. |
|
267 $menu_item_data = _wp_reset_invalid_menu_item_parent( $menu_item_data ); |
|
268 |
250 update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); |
269 update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); |
251 wp_update_post( $menu_item_data ); |
270 wp_update_post( $menu_item_data ); |
252 } |
271 } |
253 } |
272 } |
254 } |
273 } |
260 $menu_item_id = (int) $_REQUEST['menu-item']; |
279 $menu_item_id = (int) $_REQUEST['menu-item']; |
261 |
280 |
262 check_admin_referer( 'delete-menu_item_' . $menu_item_id ); |
281 check_admin_referer( 'delete-menu_item_' . $menu_item_id ); |
263 |
282 |
264 if ( is_nav_menu_item( $menu_item_id ) && wp_delete_post( $menu_item_id, true ) ) { |
283 if ( is_nav_menu_item( $menu_item_id ) && wp_delete_post( $menu_item_id, true ) ) { |
265 $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'The menu item has been successfully deleted.' ) . '</p></div>'; |
284 $messages[] = wp_get_admin_notice( |
|
285 __( 'The menu item has been successfully deleted.' ), |
|
286 array( |
|
287 'id' => 'message', |
|
288 'additional_classes' => array( 'updated' ), |
|
289 'dismissible' => true, |
|
290 ) |
|
291 ); |
266 } |
292 } |
267 |
293 |
268 break; |
294 break; |
269 |
295 |
270 case 'delete': |
296 case 'delete': |
281 if ( ! isset( $deletion ) ) { |
307 if ( ! isset( $deletion ) ) { |
282 break; |
308 break; |
283 } |
309 } |
284 |
310 |
285 if ( is_wp_error( $deletion ) ) { |
311 if ( is_wp_error( $deletion ) ) { |
286 $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . $deletion->get_error_message() . '</p></div>'; |
312 $messages[] = wp_get_admin_notice( |
|
313 $deletion->get_error_message(), |
|
314 array( |
|
315 'id' => 'message', |
|
316 'additional_classes' => array( 'error' ), |
|
317 'dismissible' => true, |
|
318 ) |
|
319 ); |
287 } else { |
320 } else { |
288 $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'The menu has been successfully deleted.' ) . '</p></div>'; |
321 $messages[] = wp_get_admin_notice( |
|
322 __( 'The menu has been successfully deleted.' ), |
|
323 array( |
|
324 'id' => 'message', |
|
325 'additional_classes' => array( 'updated' ), |
|
326 'dismissible' => true, |
|
327 ) |
|
328 ); |
289 } |
329 } |
290 |
330 |
291 break; |
331 break; |
292 |
332 |
293 case 'delete_menus': |
333 case 'delete_menus': |
299 } |
339 } |
300 |
340 |
301 $deletion = wp_delete_nav_menu( $menu_id_to_delete ); |
341 $deletion = wp_delete_nav_menu( $menu_id_to_delete ); |
302 |
342 |
303 if ( is_wp_error( $deletion ) ) { |
343 if ( is_wp_error( $deletion ) ) { |
304 $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . $deletion->get_error_message() . '</p></div>'; |
344 $messages[] = wp_get_admin_notice( |
|
345 $deletion->get_error_message(), |
|
346 array( |
|
347 'id' => 'message', |
|
348 'additional_classes' => array( 'error' ), |
|
349 'dismissible' => true, |
|
350 ) |
|
351 ); |
305 $deletion_error = true; |
352 $deletion_error = true; |
306 } |
353 } |
307 } |
354 } |
308 |
355 |
309 if ( empty( $deletion_error ) ) { |
356 if ( empty( $deletion_error ) ) { |
310 $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Selected menus have been successfully deleted.' ) . '</p></div>'; |
357 $messages[] = wp_get_admin_notice( |
|
358 __( 'Selected menus have been successfully deleted.' ), |
|
359 array( |
|
360 'id' => 'message', |
|
361 'additional_classes' => array( 'updated' ), |
|
362 'dismissible' => true, |
|
363 ) |
|
364 ); |
311 } |
365 } |
312 |
366 |
313 break; |
367 break; |
314 |
368 |
315 case 'update': |
369 case 'update': |
328 |
382 |
329 if ( $new_menu_title ) { |
383 if ( $new_menu_title ) { |
330 $_nav_menu_selected_id = wp_update_nav_menu_object( 0, array( 'menu-name' => $new_menu_title ) ); |
384 $_nav_menu_selected_id = wp_update_nav_menu_object( 0, array( 'menu-name' => $new_menu_title ) ); |
331 |
385 |
332 if ( is_wp_error( $_nav_menu_selected_id ) ) { |
386 if ( is_wp_error( $_nav_menu_selected_id ) ) { |
333 $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . $_nav_menu_selected_id->get_error_message() . '</p></div>'; |
387 $messages[] = wp_get_admin_notice( |
|
388 $_nav_menu_selected_id->get_error_message(), |
|
389 array( |
|
390 'id' => 'message', |
|
391 'additional_classes' => array( 'error' ), |
|
392 'dismissible' => true, |
|
393 ) |
|
394 ); |
334 } else { |
395 } else { |
335 $_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id ); |
396 $_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id ); |
336 $nav_menu_selected_id = $_nav_menu_selected_id; |
397 $nav_menu_selected_id = $_nav_menu_selected_id; |
337 $nav_menu_selected_title = $_menu_object->name; |
398 $nav_menu_selected_title = $_menu_object->name; |
338 |
399 |
379 |
440 |
380 wp_redirect( admin_url( 'nav-menus.php?menu=' . $_nav_menu_selected_id ) ); |
441 wp_redirect( admin_url( 'nav-menus.php?menu=' . $_nav_menu_selected_id ) ); |
381 exit; |
442 exit; |
382 } |
443 } |
383 } else { |
444 } else { |
384 $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __( 'Please enter a valid menu name.' ) . '</p></div>'; |
445 $messages[] = wp_get_admin_notice( |
|
446 __( 'Please enter a valid menu name.' ), |
|
447 array( |
|
448 'id' => 'message', |
|
449 'additional_classes' => array( 'error' ), |
|
450 'dismissible' => true, |
|
451 ) |
|
452 ); |
385 } |
453 } |
386 |
454 |
387 // Update existing menu. |
455 // Update existing menu. |
388 } else { |
456 } else { |
389 // Remove menu locations that have been unchecked. |
457 // Remove menu locations that have been unchecked. |
401 $_menu_object = wp_get_nav_menu_object( $nav_menu_selected_id ); |
469 $_menu_object = wp_get_nav_menu_object( $nav_menu_selected_id ); |
402 |
470 |
403 $menu_title = trim( esc_html( $_POST['menu-name'] ) ); |
471 $menu_title = trim( esc_html( $_POST['menu-name'] ) ); |
404 |
472 |
405 if ( ! $menu_title ) { |
473 if ( ! $menu_title ) { |
406 $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __( 'Please enter a valid menu name.' ) . '</p></div>'; |
474 $messages[] = wp_get_admin_notice( |
|
475 __( 'Please enter a valid menu name.' ), |
|
476 array( |
|
477 'id' => 'message', |
|
478 'additional_classes' => array( 'error' ), |
|
479 'dismissible' => true, |
|
480 ) |
|
481 ); |
407 $menu_title = $_menu_object->name; |
482 $menu_title = $_menu_object->name; |
408 } |
483 } |
409 |
484 |
410 if ( ! is_wp_error( $_menu_object ) ) { |
485 if ( ! is_wp_error( $_menu_object ) ) { |
411 $_nav_menu_selected_id = wp_update_nav_menu_object( $nav_menu_selected_id, array( 'menu-name' => $menu_title ) ); |
486 $_nav_menu_selected_id = wp_update_nav_menu_object( $nav_menu_selected_id, array( 'menu-name' => $menu_title ) ); |
412 |
487 |
413 if ( is_wp_error( $_nav_menu_selected_id ) ) { |
488 if ( is_wp_error( $_nav_menu_selected_id ) ) { |
414 $_menu_object = $_nav_menu_selected_id; |
489 $_menu_object = $_nav_menu_selected_id; |
415 $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . $_nav_menu_selected_id->get_error_message() . '</p></div>'; |
490 $messages[] = wp_get_admin_notice( |
|
491 $_nav_menu_selected_id->get_error_message(), |
|
492 array( |
|
493 'id' => 'message', |
|
494 'additional_classes' => array( 'error' ), |
|
495 'dismissible' => true, |
|
496 ) |
|
497 ); |
416 } else { |
498 } else { |
417 $_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id ); |
499 $_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id ); |
418 $nav_menu_selected_title = $_menu_object->name; |
500 $nav_menu_selected_title = $_menu_object->name; |
419 } |
501 } |
420 } |
502 } |
447 $new_menu_locations = array_map( 'absint', $_POST['menu-locations'] ); |
529 $new_menu_locations = array_map( 'absint', $_POST['menu-locations'] ); |
448 $menu_locations = array_merge( $menu_locations, $new_menu_locations ); |
530 $menu_locations = array_merge( $menu_locations, $new_menu_locations ); |
449 // Set menu locations. |
531 // Set menu locations. |
450 set_theme_mod( 'nav_menu_locations', $menu_locations ); |
532 set_theme_mod( 'nav_menu_locations', $menu_locations ); |
451 |
533 |
452 $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Menu locations updated.' ) . '</p></div>'; |
534 $messages[] = wp_get_admin_notice( |
|
535 __( 'Menu locations updated.' ), |
|
536 array( |
|
537 'id' => 'message', |
|
538 'additional_classes' => array( 'updated' ), |
|
539 'dismissible' => true, |
|
540 ) |
|
541 ); |
453 } |
542 } |
454 |
543 |
455 break; |
544 break; |
456 } |
545 } |
457 |
546 |
489 'moveOutFrom' => __( 'Move out from under %s' ), |
578 'moveOutFrom' => __( 'Move out from under %s' ), |
490 /* translators: %s: Previous item name. */ |
579 /* translators: %s: Previous item name. */ |
491 'under' => __( 'Under %s' ), |
580 'under' => __( 'Under %s' ), |
492 /* translators: %s: Previous item name. */ |
581 /* translators: %s: Previous item name. */ |
493 'outFrom' => __( 'Out from under %s' ), |
582 'outFrom' => __( 'Out from under %s' ), |
494 /* translators: 1: Item name, 2: Item position, 3: Total number of items. */ |
583 /* translators: 1: Item name, 2: Item type, 3: Item index, 4: Total items. */ |
495 'menuFocus' => __( '%1$s. Menu item %2$d of %3$d.' ), |
584 'menuFocus' => __( 'Edit %1$s (%2$s, %3$d of %4$d)' ), |
496 /* translators: 1: Item name, 2: Item position, 3: Parent item name. */ |
585 /* translators: 1: Item name, 2: Item type, 3: Item index, 4: Total items, 5: Item parent. */ |
497 'subMenuFocus' => __( '%1$s. Sub item number %2$d under %3$s.' ), |
586 'subMenuFocus' => __( 'Edit %1$s (%2$s, sub-item %3$d of %4$d under %5$s)' ), |
|
587 /* translators: 1: Item name, 2: Item type, 3: Item index, 4: Total items, 5: Item parent, 6: Item depth. */ |
|
588 'subMenuMoreDepthFocus' => __( 'Edit %1$s (%2$s, sub-item %3$d of %4$d under %5$s, level %6$d)' ), |
498 /* translators: %s: Item name. */ |
589 /* translators: %s: Item name. */ |
499 'menuItemDeletion' => __( 'item %s' ), |
590 'menuItemDeletion' => __( 'item %s' ), |
500 /* translators: %s: Item name. */ |
591 /* translators: %s: Item name. */ |
501 'itemsDeleted' => __( 'Deleted menu item: %s.' ), |
592 'itemsDeleted' => __( 'Deleted menu item: %s.' ), |
502 'itemAdded' => __( 'Menu item added' ), |
593 'itemAdded' => __( 'Menu item added' ), |
593 |
684 |
594 wp_nav_menu_setup(); |
685 wp_nav_menu_setup(); |
595 wp_initial_nav_menu_meta_boxes(); |
686 wp_initial_nav_menu_meta_boxes(); |
596 |
687 |
597 if ( ! current_theme_supports( 'menus' ) && ! $num_locations ) { |
688 if ( ! current_theme_supports( 'menus' ) && ! $num_locations ) { |
598 $messages[] = '<div id="message" class="updated"><p>' . sprintf( |
689 $message_no_theme_support = sprintf( |
599 /* translators: %s: URL to Widgets screen. */ |
690 /* translators: %s: URL to Widgets screen. */ |
600 __( 'Your theme does not natively support menus, but you can use them in sidebars by adding a “Navigation Menu” widget on the <a href="%s">Widgets</a> screen.' ), |
691 __( 'Your theme does not natively support menus, but you can use them in sidebars by adding a “Navigation Menu” widget on the <a href="%s">Widgets</a> screen.' ), |
601 admin_url( 'widgets.php' ) |
692 admin_url( 'widgets.php' ) |
602 ) . '</p></div>'; |
693 ); |
|
694 $messages[] = wp_get_admin_notice( |
|
695 $message_no_theme_support, |
|
696 array( |
|
697 'id' => 'message', |
|
698 'additional_classes' => array( 'updated' ), |
|
699 'dismissible' => true, |
|
700 ) |
|
701 ); |
603 } |
702 } |
604 |
703 |
605 if ( ! $locations_screen ) : // Main tab. |
704 if ( ! $locations_screen ) : // Main tab. |
606 $overview = '<p>' . __( 'This screen is used for managing your navigation menus.' ) . '</p>'; |
705 $overview = '<p>' . __( 'This screen is used for managing your navigation menus.' ) . '</p>'; |
607 $overview .= '<p>' . sprintf( |
706 $overview .= '<p>' . sprintf( |
622 'content' => $overview, |
721 'content' => $overview, |
623 ) |
722 ) |
624 ); |
723 ); |
625 |
724 |
626 $menu_management = '<p>' . __( 'The menu management box at the top of the screen is used to control which menu is opened in the editor below.' ) . '</p>'; |
725 $menu_management = '<p>' . __( 'The menu management box at the top of the screen is used to control which menu is opened in the editor below.' ) . '</p>'; |
627 $menu_management .= '<ul><li>' . __( 'To edit an existing menu, <strong>choose a menu from the drop down and click Select</strong>' ) . '</li>'; |
726 $menu_management .= '<ul><li>' . __( 'To edit an existing menu, <strong>choose a menu from the dropdown and click Select</strong>' ) . '</li>'; |
628 $menu_management .= '<li>' . __( 'If you have not yet created any menus, <strong>click the ’create a new menu’ link</strong> to get started' ) . '</li></ul>'; |
727 $menu_management .= '<li>' . __( 'If you have not yet created any menus, <strong>click the ’create a new menu’ link</strong> to get started' ) . '</li></ul>'; |
629 $menu_management .= '<p>' . __( 'You can assign theme locations to individual menus by <strong>selecting the desired settings</strong> at the bottom of the menu editor. To assign menus to all theme locations at once, <strong>visit the Manage Locations tab</strong> at the top of the screen.' ) . '</p>'; |
728 $menu_management .= '<p>' . __( 'You can assign theme locations to individual menus by <strong>selecting the desired settings</strong> at the bottom of the menu editor. To assign menus to all theme locations at once, <strong>visit the Manage Locations tab</strong> at the top of the screen.' ) . '</p>'; |
630 |
729 |
631 get_current_screen()->add_help_tab( |
730 get_current_screen()->add_help_tab( |
632 array( |
731 array( |
650 'content' => $editing_menus, |
749 'content' => $editing_menus, |
651 ) |
750 ) |
652 ); |
751 ); |
653 else : // Locations tab. |
752 else : // Locations tab. |
654 $locations_overview = '<p>' . __( 'This screen is used for globally assigning menus to locations defined by your theme.' ) . '</p>'; |
753 $locations_overview = '<p>' . __( 'This screen is used for globally assigning menus to locations defined by your theme.' ) . '</p>'; |
655 $locations_overview .= '<ul><li>' . __( 'To assign menus to one or more theme locations, <strong>select a menu from each location’s drop down.</strong> When you are finished, <strong>click Save Changes</strong>' ) . '</li>'; |
754 $locations_overview .= '<ul><li>' . __( 'To assign menus to one or more theme locations, <strong>select a menu from each location’s dropdown</strong>. When you are finished, <strong>click Save Changes</strong>' ) . '</li>'; |
656 $locations_overview .= '<li>' . __( 'To edit a menu currently assigned to a theme location, <strong>click the adjacent ’Edit’ link</strong>' ) . '</li>'; |
755 $locations_overview .= '<li>' . __( 'To edit a menu currently assigned to a theme location, <strong>click the adjacent ’Edit’ link</strong>' ) . '</li>'; |
657 $locations_overview .= '<li>' . __( 'To add a new menu instead of assigning an existing one, <strong>click the ’Use new menu’ link</strong>. Your new menu will be automatically assigned to that theme location' ) . '</li></ul>'; |
756 $locations_overview .= '<li>' . __( 'To add a new menu instead of assigning an existing one, <strong>click the ’Use new menu’ link</strong>. Your new menu will be automatically assigned to that theme location' ) . '</li></ul>'; |
658 |
757 |
659 get_current_screen()->add_help_tab( |
758 get_current_screen()->add_help_tab( |
660 array( |
759 array( |
665 ); |
764 ); |
666 endif; |
765 endif; |
667 |
766 |
668 get_current_screen()->set_help_sidebar( |
767 get_current_screen()->set_help_sidebar( |
669 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
768 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
670 '<p>' . __( '<a href="https://wordpress.org/support/article/appearance-menus-screen/">Documentation on Menus</a>' ) . '</p>' . |
769 '<p>' . __( '<a href="https://wordpress.org/documentation/article/appearance-menus-screen/">Documentation on Menus</a>' ) . '</p>' . |
671 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' |
770 '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>' |
672 ); |
771 ); |
673 |
772 |
674 // Get the admin header. |
773 // Get the admin header. |
675 require_once ABSPATH . 'wp-admin/admin-header.php'; |
774 require_once ABSPATH . 'wp-admin/admin-header.php'; |
676 ?> |
775 ?> |
833 <?php else : ?> |
937 <?php else : ?> |
834 <div class="manage-menus"> |
938 <div class="manage-menus"> |
835 <?php if ( $menu_count < 1 ) : ?> |
939 <?php if ( $menu_count < 1 ) : ?> |
836 <span class="first-menu-message"> |
940 <span class="first-menu-message"> |
837 <?php _e( 'Create your first menu below.' ); ?> |
941 <?php _e( 'Create your first menu below.' ); ?> |
838 <span class="screen-reader-text"><?php _e( 'Fill in the Menu Name and click the Create Menu button to create your first menu.' ); ?></span> |
942 <span class="screen-reader-text"> |
|
943 <?php |
|
944 /* translators: Hidden accessibility text. */ |
|
945 _e( 'Fill in the Menu Name and click the Create Menu button to create your first menu.' ); |
|
946 ?> |
|
947 </span> |
839 </span><!-- /first-menu-message --> |
948 </span><!-- /first-menu-message --> |
840 <?php elseif ( $menu_count < 2 ) : ?> |
949 <?php elseif ( $menu_count < 2 ) : ?> |
841 <span class="add-edit-menu-action"> |
950 <span class="add-edit-menu-action"> |
842 <?php |
951 <?php |
843 printf( |
952 printf( |
852 admin_url( 'nav-menus.php' ) |
961 admin_url( 'nav-menus.php' ) |
853 ) |
962 ) |
854 ) |
963 ) |
855 ); |
964 ); |
856 ?> |
965 ?> |
857 <span class="screen-reader-text"><?php _e( 'Click the Save Menu button to save your changes.' ); ?></span> |
966 <span class="screen-reader-text"> |
|
967 <?php |
|
968 /* translators: Hidden accessibility text. */ |
|
969 _e( 'Click the Save Menu button to save your changes.' ); |
|
970 ?> |
|
971 </span> |
858 </span><!-- /add-edit-menu-action --> |
972 </span><!-- /add-edit-menu-action --> |
859 <?php else : ?> |
973 <?php else : ?> |
860 <form method="get" action="<?php echo esc_url( admin_url( 'nav-menus.php' ) ); ?>"> |
974 <form method="get" action="<?php echo esc_url( admin_url( 'nav-menus.php' ) ); ?>"> |
861 <input type="hidden" name="action" value="edit" /> |
975 <input type="hidden" name="action" value="edit" /> |
862 <label for="select-menu-to-edit" class="selected-menu"><?php _e( 'Select a menu to edit:' ); ?></label> |
976 <label for="select-menu-to-edit" class="selected-menu"><?php _e( 'Select a menu to edit:' ); ?></label> |
998 <div class="drag-instructions post-body-plain" <?php echo $hide_style; ?>> |
1117 <div class="drag-instructions post-body-plain" <?php echo $hide_style; ?>> |
999 <p><?php echo $starter_copy; ?></p> |
1118 <p><?php echo $starter_copy; ?></p> |
1000 </div> |
1119 </div> |
1001 |
1120 |
1002 <?php if ( ! $add_new_screen ) : ?> |
1121 <?php if ( ! $add_new_screen ) : ?> |
1003 <div id="nav-menu-bulk-actions-top" class="bulk-actions"> |
1122 <div id="nav-menu-bulk-actions-top" class="bulk-actions" <?php echo $hide_style; ?>> |
1004 <label class="bulk-select-button" for="bulk-select-switcher-top"> |
1123 <label class="bulk-select-button" for="bulk-select-switcher-top"> |
1005 <input type="checkbox" id="bulk-select-switcher-top" name="bulk-select-switcher-top" class="bulk-select-switcher"> |
1124 <input type="checkbox" id="bulk-select-switcher-top" name="bulk-select-switcher-top" class="bulk-select-switcher"> |
1006 <span class="bulk-select-button-label"><?php _e( 'Bulk Select' ); ?></span> |
1125 <span class="bulk-select-button-label"><?php _e( 'Bulk Select' ); ?></span> |
1007 </label> |
1126 </label> |
1008 </div> |
1127 </div> |
1033 $no_menus_style = 'style="display: none;"'; |
1152 $no_menus_style = 'style="display: none;"'; |
1034 } |
1153 } |
1035 ?> |
1154 ?> |
1036 |
1155 |
1037 <?php if ( ! $add_new_screen ) : ?> |
1156 <?php if ( ! $add_new_screen ) : ?> |
1038 <div id="nav-menu-bulk-actions-bottom" class="bulk-actions"> |
1157 <div id="nav-menu-bulk-actions-bottom" class="bulk-actions" <?php echo $hide_style; ?>> |
1039 <label class="bulk-select-button" for="bulk-select-switcher-bottom"> |
1158 <label class="bulk-select-button" for="bulk-select-switcher-bottom"> |
1040 <input type="checkbox" id="bulk-select-switcher-bottom" name="bulk-select-switcher-top" class="bulk-select-switcher"> |
1159 <input type="checkbox" id="bulk-select-switcher-bottom" name="bulk-select-switcher-top" class="bulk-select-switcher"> |
1041 <span class="bulk-select-button-label"><?php _e( 'Bulk Select' ); ?></span> |
1160 <span class="bulk-select-button-label"><?php _e( 'Bulk Select' ); ?></span> |
1042 </label> |
1161 </label> |
1043 <input type="button" class="deletion menu-items-delete disabled" value="<?php _e( 'Remove Selected Items' ); ?>"> |
1162 <input type="button" class="deletion menu-items-delete disabled" value="<?php esc_attr_e( 'Remove Selected Items' ); ?>"> |
1044 <div id="pending-menu-items-to-delete"> |
1163 <div id="pending-menu-items-to-delete"> |
1045 <p><?php _e( 'List of menu items selected for deletion:' ); ?></p> |
1164 <p><?php _e( 'List of menu items selected for deletion:' ); ?></p> |
1046 <ul></ul> |
1165 <ul></ul> |
1047 </div> |
1166 </div> |
1048 </div> |
1167 </div> |
1108 |
1227 |
1109 </div> |
1228 </div> |
1110 </div><!-- /#post-body-content --> |
1229 </div><!-- /#post-body-content --> |
1111 </div><!-- /#post-body --> |
1230 </div><!-- /#post-body --> |
1112 <div id="nav-menu-footer"> |
1231 <div id="nav-menu-footer"> |
1113 <div class="major-publishing-actions wp-clearfix"> |
1232 <div class="major-publishing-actions"> |
|
1233 <div class="publishing-action"> |
|
1234 <?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'primary large menu-save', 'save_menu', false, array( 'id' => 'save_menu_footer' ) ); ?> |
|
1235 </div><!-- END .publishing-action --> |
1114 <?php if ( $menu_count > 0 ) : ?> |
1236 <?php if ( $menu_count > 0 ) : ?> |
1115 |
1237 |
1116 <?php if ( $add_new_screen ) : ?> |
1238 <?php if ( $add_new_screen ) : ?> |
1117 <span class="cancel-action"> |
1239 <span class="cancel-action"> |
1118 <a class="submitcancel cancellation menu-cancel" href="<?php echo esc_url( admin_url( 'nav-menus.php' ) ); ?>"><?php _e( 'Cancel' ); ?></a> |
1240 <a class="submitcancel cancellation menu-cancel" href="<?php echo esc_url( admin_url( 'nav-menus.php' ) ); ?>"><?php _e( 'Cancel' ); ?></a> |
1137 "><?php _e( 'Delete Menu' ); ?></a> |
1259 "><?php _e( 'Delete Menu' ); ?></a> |
1138 </span><!-- END .delete-action --> |
1260 </span><!-- END .delete-action --> |
1139 <?php endif; ?> |
1261 <?php endif; ?> |
1140 |
1262 |
1141 <?php endif; ?> |
1263 <?php endif; ?> |
1142 <div class="publishing-action"> |
|
1143 <?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'primary large menu-save', 'save_menu', false, array( 'id' => 'save_menu_footer' ) ); ?> |
|
1144 </div><!-- END .publishing-action --> |
|
1145 </div><!-- END .major-publishing-actions --> |
1264 </div><!-- END .major-publishing-actions --> |
1146 </div><!-- /#nav-menu-footer --> |
1265 </div><!-- /#nav-menu-footer --> |
1147 </div><!-- /.menu-edit --> |
1266 </div><!-- /.menu-edit --> |
1148 </form><!-- /#update-nav-menu --> |
1267 </form><!-- /#update-nav-menu --> |
1149 </div><!-- /#menu-management --> |
1268 </div><!-- /#menu-management --> |