Ticket #5303: post.diff
File post.diff, 1.1 KB (added by , 15 years ago) |
---|
-
wp-includes/post.php
2147 2147 * @param array $pages List of pages' objects. 2148 2148 * @return array 2149 2149 */ 2150 function &get_page_children($page_id, $pages) {2150 function &get_page_children($page_id, &$pages) { 2151 2151 $page_list = array(); 2152 foreach ( (array) $pages as $page ) { 2152 if(is_object($pages))$p=(array)$pages; 2153 else $p=&$pages; 2154 $pc=count($p); 2155 $pp=array(); 2156 foreach ($p as $page) { 2153 2157 if ( $page->post_parent == $page_id ) { 2154 2158 $page_list[] = $page; 2155 if ( $children = get_page_children($page->ID, $pages) )2156 $page_list = array_merge($page_list, $children);2159 }else{ 2160 $pp[]=$page; 2157 2161 } 2158 2162 } 2163 $p=$pp; 2164 $plc=count($page_list); 2165 $page_list2=array(); 2166 if(count($p))for($i=0;$i<$plc;$i++){ 2167 if ($children = get_page_children($page_list[$i]->ID, $p) ) 2168 $page_list2[$i] = $children; 2169 if(!count($p))break; 2170 } 2171 if(count($page_list2))foreach($page_list2 as $i=>$children){ 2172 array_splice($page_list,$i+1,0,$children); 2173 } 2159 2174 return $page_list; 2160 2175 } 2161 2176