diff --git a/wp-admin/includes/nav-menu.php b/wp-admin/includes/nav-menu.php new file mode 100644 index 000000000..f0cceaeb3 --- /dev/null +++ b/wp-admin/includes/nav-menu.php @@ -0,0 +1,236 @@ + 0, + 'sort_order' => 'ASC', + 'sort_column' => 'post_title', + 'hierarchical' => 1, + 'exclude' => '', + 'include' => '', + 'meta_key' => '', + 'meta_value' => '', + 'authors' => '', + 'parent' => -1, + 'exclude_tree' => '', + 'number' => '', + 'offset' => 0 ); + + //GET all pages + $pages_array = get_pages($pages_args); + + $intCounter = $counter; + $parentli = $intCounter; + + if ( !$pages_array ) { + echo 'Not Found'; + return $intCounter; + } + + // Display Loop + foreach ( $pages_array as $post ) { + if ( $post->post_parent == 0 ) { + $post = wp_setup_nav_menu_item($post, 'page', $intCounter); + if ( $type == 'menu' ) { + ?> + + + + +
  • + ID; + $intCounter++; + $intCounter = wp_nav_menu_sub_items($post->ID, $intCounter, $parentli, 'pages', 'default'); + ?> +
  • + + 'post', + 'child_of' => 0, + 'orderby' => 'name', + 'order' => 'ASC', + 'hide_empty' => false, + 'include_last_update_time' => false, + 'hierarchical' => 1, + 'exclude' => '', + 'include' => '', + 'number' => '', + 'pad_counts' => false ); + + $intCounter = $counter; + + // Get all categories + $categories_array = get_categories($category_args); + + if ( !$categories_array ) { + _e('Not Found'); + return $intCounter; + } + + // Display Loop + foreach ( $categories_array as $cat_item ) { + if ( $cat_item->parent == 0 ) { + $cat_item = wp_setup_nav_menu_item($cat_item, 'category', $intCounter); + // Custom Menu + if ( $type == 'menu' ) { + ?> + + + + +
  • + cat_ID; + $intCounter++; + $intCounter = wp_nav_menu_sub_items($cat_item->cat_ID, $intCounter, $parentli, 'categories', 'default'); + ?> + +
  • + + $childof, + 'hide_empty' => false, + 'parent' => $childof); + } elseif ( $output_type == 'default' ) { + // Sidebar Menu + $sub_args = array( + 'child_of' => $childof, + 'hide_empty' => false, + 'parent' => $childof); + } + + if ( $type == 'categories' ) { + // Get Sub Category Items + $item_type = 'category'; + $sub_array = get_categories($sub_args); + } elseif ($type == 'pages') { + // Get Sub Page Items + $item_type = 'page'; + $sub_array = get_pages($sub_args); + } else { + $item_type = 'custom'; + $sub_array = array(); + } + + + if ( $sub_array ) { + ?> + + + term_id ); + } + } + + wp_create_nav_menu( __('Main') ); +} + +?> \ No newline at end of file diff --git a/wp-admin/menu.php b/wp-admin/menu.php index bbe2f2582..9f8bc384d 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -108,7 +108,7 @@ $menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-to $submenu['themes.php'][5] = array(__('Themes'), 'switch_themes', 'themes.php'); $submenu['themes.php'][10] = array(_x('Editor', 'theme editor'), 'edit_themes', 'theme-editor.php'); $submenu['themes.php'][15] = array(__('Add New Themes'), 'install_themes', 'theme-install.php'); - $submenu['themes.php'][20] = array(__('Menus'), 'switch_themes', 'custom-navigation.php'); + $submenu['themes.php'][20] = array(__('Menus'), 'switch_themes', 'nav-menus.php'); $update_plugins = get_site_transient( 'update_plugins' ); $update_count = 0; diff --git a/wp-admin/custom-navigation.php b/wp-admin/nav-menus.php similarity index 94% rename from wp-admin/custom-navigation.php rename to wp-admin/nav-menus.php index ac6164cdc..321016069 100644 --- a/wp-admin/custom-navigation.php +++ b/wp-admin/nav-menus.php @@ -27,7 +27,7 @@ wp_enqueue_script( 'jquery-autocomplete' ); wp_enqueue_script( 'custom-navigation-php-functions' ); require_once('admin-header.php'); -require_once (ABSPATH . WPINC . '/custom-navigation.php'); +require_once(ABSPATH . 'wp-admin/includes/nav-menu.php'); function wp_reset_nav_menu() { wp_custom_navigation_setup(true); @@ -171,8 +171,8 @@ if ( isset($_POST['reset_wp_menu']) && ! $updated ) {

    -

    -
    + +

      term_id ) || ( $menu_selected_id == $menu->term_id ) ) { ?>
    • name ) . $sep; ?>
    • -
    • name ); ?>
    • +
    • name ); ?>
    • @@ -200,7 +200,7 @@ if ( isset($_POST['reset_wp_menu']) && ! $updated ) { echo '

      ' . __('Menu editing has not been Enabled yet. Please enable it in order to use it -------->') . '

      '; ?> -
      + @@ -223,7 +223,7 @@ if ( isset($_POST['reset_wp_menu']) && ! $updated ) { // SET output type $output_type = "backend"; // MAIN OUTPUT FUNCTION - wp_custom_navigation_output( 'type='.$output_type.'&name='.$menu_title.'&id='.$menu_selected_id ); + wp_print_nav_menu( 'type='.$output_type.'&name='.$menu_title.'&id='.$menu_selected_id ); } ?> @@ -382,7 +382,7 @@ if ( isset($_POST['reset_wp_menu']) && ! $updated ) {
    @@ -462,7 +462,7 @@ if ( isset($_POST['reset_wp_menu']) && ! $updated ) {
    @@ -489,11 +489,17 @@ if ( isset($_POST['reset_wp_menu']) && ! $updated ) {
    -
    - + + -