Make WordPress Core

Ticket #29870: 29870.diff

File 29870.diff, 1.9 KB (added by A5hleyRich, 10 years ago)
  • src/wp-admin/includes/class-wp-posts-list-table.php

    diff --git src/wp-admin/includes/class-wp-posts-list-table.php src/wp-admin/includes/class-wp-posts-list-table.php
    index 8a0f6d2..407230c 100644
    class WP_Posts_List_Table extends WP_List_Table { 
    9797
    9898                $this->hierarchical_display = ( is_post_type_hierarchical( $this->screen->post_type ) && 'menu_order title' == $wp_query->query['orderby'] );
    9999
    100                 $total_items = $this->hierarchical_display ? $wp_query->post_count : $wp_query->found_posts;
    101 
    102100                $post_type = $this->screen->post_type;
    103101                $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' );
    104102
    105103                /** This filter is documented in wp-admin/includes/post.php */
    106104                $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type );
    107105
    108                 if ( $this->hierarchical_display )
    109                         $total_pages = ceil( $total_items / $per_page );
    110                 else
    111                         $total_pages = $wp_query->max_num_pages;
     106                if ( $this->hierarchical_display ) {
     107                        $total_items = $wp_query->post_count;
     108                }
     109                else {
     110                        $post_counts = wp_count_posts( $post_type, 'readable' );
     111
     112                        if ( isset( $_REQUEST['post_status'] ) && in_array( $_REQUEST['post_status'] , $avail_post_stati ) ) {
     113                                $total_items = $post_counts->$_REQUEST['post_status'];
     114                        }
     115                        else if ( isset( $_REQUEST['show_sticky'] ) && $_REQUEST['show_sticky'] ) {
     116                                $total_items = $this->sticky_posts_count;
     117                        }
     118                        else {
     119                                $total_items = array_sum( (array) $post_counts );
     120
     121                                // Subtract post types that are not included in the admin all list.
     122                                foreach ( get_post_stati( array('show_in_admin_all_list' => false) ) as $state ) {
     123                                        $total_items -= $post_counts->$state;
     124                                }
     125                        }
     126                }
     127
     128                $total_pages = ceil( $total_items / $per_page );
    112129
    113130                if ( ! empty( $_REQUEST['mode'] ) ) {
    114131                        $mode = $_REQUEST['mode'] == 'excerpt' ? 'excerpt' : 'list';