walk_page_tree() fix from Mark J. fixes #2516
git-svn-id: https://develop.svn.wordpress.org/trunk@3579 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
9055457e82
commit
0b9513d43c
@ -740,7 +740,7 @@ function walk_page_tree($pages, $to_depth, $start_element_callback, $end_element
|
||||
foreach ( $pages as $page ) {
|
||||
if ( !empty($previous_page) && ($page->post_parent == $previous_page->ID) ) {
|
||||
// Previous page is my parent. Descend a level.
|
||||
array_unshift($parents, $page);
|
||||
array_unshift($parents, $previous_page);
|
||||
$depth++;
|
||||
if ( !$to_depth || ($depth < $to_depth) )
|
||||
if ( !empty($start_level_callback) ) {
|
||||
@ -764,7 +764,7 @@ function walk_page_tree($pages, $to_depth, $start_element_callback, $end_element
|
||||
}
|
||||
}
|
||||
|
||||
while ( $parent = array_shift($parents)) {
|
||||
while ( $parent = array_shift($parents) ) {
|
||||
$depth--;
|
||||
if ( !$to_depth || ($depth < $to_depth) ) {
|
||||
if ( !empty($end_level_callback) ) {
|
||||
@ -776,7 +776,7 @@ function walk_page_tree($pages, $to_depth, $start_element_callback, $end_element
|
||||
$output = call_user_func_array($end_element_callback, $cb_args);
|
||||
}
|
||||
}
|
||||
if ( $page->post_parent == $parent->ID ) {
|
||||
if ( $page->post_parent == $parents[0]->ID ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user