WordPress.org

Make WordPress Core

Changeset 13198


Ignore:
Timestamp:
02/18/2010 08:01:10 PM (9 years ago)
Author:
ryan
Message:

Don't include internal post types in the total. see #9674

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit.php

    r13172 r13198  
    229229}
    230230
    231 $total_posts = array_sum( (array) $num_posts ) - $num_posts->trash;
     231$total_posts = array_sum( (array) $num_posts );
     232
     233// Subtract post types that are not included in the admin all list.
     234foreach ( get_post_stati( array('show_in_admin_all_list' => false) ) as $state )
     235    $total_posts -= $num_posts->$state;
     236
    232237$class = empty($class) && empty($_GET['post_status']) ? ' class="current"' : '';
    233238$status_links[] = "<li><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>';
  • trunk/wp-includes/post.php

    r13192 r13198  
    14261426    $count = $wpdb->get_results( $wpdb->prepare( $query, $type ), ARRAY_A );
    14271427
    1428     $stats = array( 'publish' => 0, 'private' => 0, 'draft' => 0, 'pending' => 0, 'future' => 0, 'trash' => 0 );
    1429     foreach( (array) $count as $row_num => $row ) {
     1428    $stats = array_fill_keys( get_post_stati(), 0);
     1429    foreach ( (array) $count as $row_num => $row )
    14301430        $stats[$row['post_status']] = $row['num_posts'];
    1431     }
    14321431
    14331432    $stats = (object) $stats;
Note: See TracChangeset for help on using the changeset viewer.