Reduce queries by wp_count_posts(). Props josephscott. fixes #5820

git-svn-id: https://develop.svn.wordpress.org/trunk@6808 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2008-02-13 09:30:26 +00:00
parent 9d87bc73e7
commit 0f8e3b6164
4 changed files with 26 additions and 27 deletions
+2 -2
View File
@@ -52,18 +52,18 @@ if ( is_single() ) {
<ul class="subsubsub">
<?php
$status_links = array();
$num_posts = wp_count_posts('post');
foreach ( $post_stati as $status => $label ) {
$class = '';
if ( !in_array($status, $avail_post_stati) )
continue;
$num_posts = wp_count_posts('post', $status);
if ( $status == $_GET['post_status'] )
$class = ' class="current"';
$status_links[] = "<li><a href=\"edit.php?post_status=$status\"$class>" .
sprintf($label[2], $num_posts) . '</a>';
sprintf($label[2], $num_posts->$status) . '</a>';
}
$class = empty($_GET['post_status']) ? ' class="current"' : '';
$status_links[] = "<li><a href=\"edit.php\"$class>All Posts</a>";