Ticket #15459: 15459.4.diff
File 15459.4.diff, 4.8 KB (added by , 10 years ago) |
---|
-
wp-admin/includes/post.php
985 985 $query['order'] = 'asc'; 986 986 $query['posts_per_page'] = -1; 987 987 $query['posts_per_archive_page'] = -1; 988 $query['fields'] = 'id=>parent'; 988 989 } 989 990 990 991 if ( ! empty( $q['show_sticky'] ) ) -
wp-admin/includes/class-wp-posts-list-table.php
450 450 $count = 0; 451 451 $start = ( $pagenum - 1 ) * $per_page; 452 452 $end = $start + $per_page; 453 $to_display = array(); 453 454 454 455 foreach ( $pages as $page ) { 455 456 if ( $count >= $end ) 456 457 break; 457 458 458 459 if ( $count >= $start ) { 459 echo "\t"; 460 $this->single_row( $page, $level ); 460 $to_display[$page->ID] = $level; 461 461 } 462 462 463 463 $count++; 464 464 465 465 if ( isset( $children_pages ) ) 466 $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );466 $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display ); 467 467 } 468 468 469 469 // If it is the last pagenum and there are orphaned pages, display them with paging as well. … … 474 474 break; 475 475 476 476 if ( $count >= $start ) { 477 echo "\t"; 478 $this->single_row( $op, 0 ); 477 $to_display[$op->ID] = 0; 479 478 } 480 479 481 480 $count++; 482 481 } 483 482 } 484 483 } 484 485 $ids = array_keys( $to_display ); 486 _prime_post_caches( $ids ); 487 488 if ( ! isset( $GLOBALS['post'] ) ) { 489 // touch_time() requires a global post set 490 $GLOBALS['post'] = array_shift( $ids ); 491 } 492 493 foreach ( $to_display as $page_id => $level ) { 494 echo "\t"; 495 $this->single_row( $page_id, $level ); 496 } 485 497 } 486 498 487 499 /** … … 496 508 * @param int $level 497 509 * @param int $pagenum 498 510 * @param int $per_page 511 * @param array $to_display list of pages to be displayed 499 512 */ 500 private function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {513 private function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page, &$to_display ) { 501 514 502 515 if ( ! isset( $children_pages[$parent] ) ) 503 516 return; … … 515 528 $my_parents = array(); 516 529 $my_parent = $page->post_parent; 517 530 while ( $my_parent ) { 518 $my_parent = get_post( $my_parent ); 531 // Get the ID from the list or the attribute if my_parent is an object 532 $parent_id = $my_parent; 533 if ( is_object( $my_parent ) ) { 534 $parent_id = $my_parent->ID; 535 } 536 537 $my_parent = get_post( $parent_id ); 519 538 $my_parents[] = $my_parent; 520 539 if ( !$my_parent->post_parent ) 521 540 break; … … 523 542 } 524 543 $num_parents = count( $my_parents ); 525 544 while ( $my_parent = array_pop( $my_parents ) ) { 526 echo "\t"; 527 $this->single_row( $my_parent, $level - $num_parents ); 545 $to_display[$my_parent->ID] = $level - $num_parents; 528 546 $num_parents--; 529 547 } 530 548 } 531 549 532 550 if ( $count >= $start ) { 533 echo "\t"; 534 $this->single_row( $page, $level ); 551 $to_display[$page->ID] = $level; 535 552 } 536 553 537 554 $count++; 538 555 539 $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );556 $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page, $to_display ); 540 557 } 541 558 542 559 unset( $children_pages[$parent] ); //required in order to keep track of orphans … … 547 564 static $alternate; 548 565 549 566 $global_post = get_post(); 567 568 if ( is_integer( $post ) ) { 569 $post = get_post( $post ); 570 } 571 550 572 $GLOBALS['post'] = $post; 551 573 setup_postdata( $post ); 552 574 -
wp-includes/class-wp.php
25 25 * @since 2.0.0 26 26 * @var array 27 27 */ 28 public $private_query_vars = array( 'offset', 'posts_per_page', 'posts_per_archive_page', 'showposts', 'nopaging', 'post_type', 'post_status', 'category__in', 'category__not_in', 'category__and', 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'tag_id', 'post_mime_type', 'perm', 'comments_per_page', 'post__in', 'post__not_in', 'post_parent', 'post_parent__in', 'post_parent__not_in' );28 public $private_query_vars = array( 'offset', 'posts_per_page', 'posts_per_archive_page', 'showposts', 'nopaging', 'post_type', 'post_status', 'category__in', 'category__not_in', 'category__and', 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'tag_id', 'post_mime_type', 'perm', 'comments_per_page', 'post__in', 'post__not_in', 'post_parent', 'post_parent__in', 'post_parent__not_in', 'fields' ); 29 29 30 30 /** 31 31 * Extra query variables set by the user.