diff --git a/wp-admin/custom-navigation.php b/wp-admin/custom-navigation.php index 6c7937feea..28a52c810e 100644 --- a/wp-admin/custom-navigation.php +++ b/wp-admin/custom-navigation.php @@ -134,7 +134,6 @@ function wp_custom_navigation() { for ( $k = 1; $k <= $postCounter; $k++ ) { if (isset($_POST['dbid'.$k])) { $db_id = $_POST['dbid'.$k]; } else { $db_id = 0; } if (isset($_POST['postmenu'.$k])) { $object_id = $_POST['postmenu'.$k]; } else { $object_id = 0; } - //@todo implement heirarchy if (isset($_POST['parent'.$k])) { $parent_id = $_POST['parent'.$k]; } else { $parent_id = 0; } if (isset($_POST['title'.$k])) { $custom_title = $_POST['title'.$k]; } else { $custom_title = ''; } if (isset($_POST['linkurl'.$k])) { $custom_linkurl = $_POST['linkurl'.$k]; } else { $custom_linkurl = ''; } @@ -154,6 +153,8 @@ function wp_custom_navigation() { $post['post_content_filtered'] = '_blank'; else $post['post_content_filtered'] = ''; + if ( $parent_id > 0 && isset( $_POST[ 'dbid' . $parent_id ] ) ) + $post[ 'post_parent' ] = (int) $_POST[ 'dbid' . $parent_id ]; // New menu item if ( $db_id == 0 ) { diff --git a/wp-includes/custom-navigation.php b/wp-includes/custom-navigation.php index 0932aa65ef..11b789acf9 100644 --- a/wp-includes/custom-navigation.php +++ b/wp-includes/custom-navigation.php @@ -114,6 +114,8 @@ function wp_custom_navigation_output($args = array()) { $queried_id = $wp_query->get_queried_object_id(); elseif ( is_category() ) $queried_id = $wp_query->get_queried_object_id(); + + $parent_stack = array(); // Display Loop foreach ( $menu_items as $menu_item ) { $menu_type = get_post_meta($menu_item->ID, 'menu_type', true); @@ -191,6 +193,27 @@ function wp_custom_navigation_output($args = array()) { } } */ + // Indent children + if ( empty( $parent_stack ) ) { + array_unshift( $parent_stack, $menu_item->ID ); + } elseif ( $menu_item->post_parent > 0 ) { + if ( $menu_item->post_parent == $parent_stack[0] ) { ?> + + + +ID; + } + // List Items ?> - + + + +