Make WordPress Core

Ticket #24869: 24869.3.diff

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

     
    137137                        echo get_post_type_object( $this->screen->post_type )->labels->not_found;
    138138        }
    139139
     140        protected function is_base_request() {
     141                if ( empty( $_GET ) ) {
     142                        return true;
     143                } elseif ( 1 === count( $_GET ) && ! empty( $_GET['post_type'] ) ) {
     144                        return $this->screen->post_type === $_GET['post_type'];
     145                }
     146        }
     147
    140148        protected function get_views() {
    141149                global $locked_post_status, $avail_post_stati;
    142150
     
    165173                foreach ( get_post_stati( array('show_in_admin_all_list' => false) ) as $state )
    166174                        $total_posts -= $num_posts->$state;
    167175
    168                 $class = empty( $class ) && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['show_sticky'] ) ? ' class="current"' : '';
    169                 $status_links['all'] = "<a href='edit.php?post_type=$post_type{$allposts}'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . '</a>';
     176                if ( empty( $class ) && $this->is_base_request() ) {
     177                        $class =  ' class="current"';
     178                }
    170179
     180                $all_inner_html = sprintf(
     181                        _nx(
     182                                'All <span class="count">(%s)</span>',
     183                                'All <span class="count">(%s)</span>',
     184                                $total_posts,
     185                                'posts'
     186                        ),
     187                        number_format_i18n( $total_posts )
     188                );
     189
     190                $status_links['all'] = "<a href='edit.php?post_type=$post_type{$allposts}'$class>" . $all_inner_html . '</a>';
     191
    171192                foreach ( get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status ) {
    172193                        $class = '';
    173194