diff --git a/wp-includes/custom-navigation.php b/wp-includes/custom-navigation.php
index 11b789acf9..354d95fd95 100644
--- a/wp-includes/custom-navigation.php
+++ b/wp-includes/custom-navigation.php
@@ -116,11 +116,17 @@ function wp_custom_navigation_output($args = array()) {
$queried_id = $wp_query->get_queried_object_id();
$parent_stack = array();
+ $parent_menu_order = array();
// Display Loop
foreach ( $menu_items as $menu_item ) {
$menu_type = get_post_meta($menu_item->ID, 'menu_type', true);
$object_id = get_post_meta($menu_item->ID, 'object_id', true);
-
+ $parent_menu_order[ $menu_item->ID ] = $menu_item->menu_order;
+ if ( isset( $parent_menu_order[ $menu_item->post_parent ] ) )
+ $parent_item = $parent_menu_order[ $menu_item->post_parent ];
+ else
+ $parent_item = 0;
+
switch ( $menu_type ) {
// Page Menu Item
case 'page':
@@ -209,7 +215,11 @@ function wp_custom_navigation_output($args = array()) {
array_shift( $parent_stack );
}
}
- } else { ?>
+ } else {
+ while ( count( $parent_stack ) > 1 ) { ?>
+
+ array_shift( $parent_stack );
+ } ?>
ID;
}
@@ -267,7 +277,7 @@ function wp_custom_navigation_output($args = array()) {
-
+