Changeset 34271
- Timestamp:
- 09/17/2015 09:17:16 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-posts-list-table.php
r34238 r34271 132 132 $this->set_hierarchical_display( is_post_type_hierarchical( $this->screen->post_type ) && 'menu_order title' == $wp_query->query['orderby'] ); 133 133 134 $total_items = $this->hierarchical_display ? $wp_query->post_count : $wp_query->found_posts;135 136 134 $post_type = $this->screen->post_type; 137 135 $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' ); … … 140 138 $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type ); 141 139 142 if ( $this->hierarchical_display ) 143 $total_pages = ceil( $total_items / $per_page ); 144 else 145 $total_pages = $wp_query->max_num_pages; 140 if ( $this->hierarchical_display ) { 141 $total_items = $wp_query->post_count; 142 } else { 143 $post_counts = (array) wp_count_posts( $post_type, 'readable' ); 144 145 if ( isset( $_REQUEST['post_status'] ) && in_array( $_REQUEST['post_status'] , $avail_post_stati ) ) { 146 $total_items = $post_counts[ $_REQUEST['post_status'] ]; 147 } elseif ( isset( $_REQUEST['show_sticky'] ) && $_REQUEST['show_sticky'] ) { 148 $total_items = $this->sticky_posts_count; 149 } else { 150 $total_items = array_sum( $post_counts ); 151 152 // Subtract post types that are not included in the admin all list. 153 foreach ( get_post_stati( array( 'show_in_admin_all_list' => false ) ) as $state ) { 154 $total_items -= $post_counts[ $state ]; 155 } 156 } 157 } 158 159 $total_pages = ceil( $total_items / $per_page ); 146 160 147 161 if ( ! empty( $_REQUEST['mode'] ) ) {
Note: See TracChangeset
for help on using the changeset viewer.