Sometimes people have huge numbers of posts, let's always number_format them. Also, additional related link.

git-svn-id: http://svn.automattic.com/wordpress/trunk@7485 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
matt 2008-03-23 07:10:17 +00:00
parent 94c34601ef
commit 7d7a28c515
5 changed files with 13 additions and 12 deletions

View File

@ -168,6 +168,7 @@ if ( ( 'edit' == $action) && current_user_can('delete_post', $post_ID) )
<li><a href="edit.php"><?php _e('Manage All Posts') ?></a></li> <li><a href="edit.php"><?php _e('Manage All Posts') ?></a></li>
<li><a href="categories.php"><?php _e('Manage All Categories') ?></a></li> <li><a href="categories.php"><?php _e('Manage All Categories') ?></a></li>
<li><a href="edit-tags.php"><?php _e('Manage All Tags') ?></a></li> <li><a href="edit-tags.php"><?php _e('Manage All Tags') ?></a></li>
<li><a href="edit.php?post_status=draft"><?php _e('View Drafts'); ?></a></li>
<?php do_action('post_relatedlinks_list'); ?> <?php do_action('post_relatedlinks_list'); ?>
</ul> </ul>
</div> </div>

View File

@ -93,7 +93,7 @@ foreach ( $post_stati as $status => $label ) {
$class = ' class="current"'; $class = ' class="current"';
$status_links[] = "<li><a href=\"edit-pages.php?post_status=$status\"$class>" . $status_links[] = "<li><a href=\"edit-pages.php?post_status=$status\"$class>" .
sprintf(__ngettext($label[2][0], $label[2][1], $num_posts->$status), $num_posts->$status) . '</a>'; sprintf(__ngettext($label[2][0], $label[2][1], $num_posts->$status), number_format_i18n( $num_posts->$status ) ) . '</a>';
} }
echo implode(' |</li>', $status_links) . '</li>'; echo implode(' |</li>', $status_links) . '</li>';
unset($status_links); unset($status_links);

View File

@ -82,25 +82,25 @@ if ( is_single() ) {
<ul class="subsubsub"> <ul class="subsubsub">
<?php <?php
$status_links = array(); $status_links = array();
$num_posts = wp_count_posts('post', 'readable'); $num_posts = wp_count_posts( 'post', 'readable' );
$class = empty($_GET['post_status']) ? ' class="current"' : ''; $class = empty( $_GET['post_status'] ) ? ' class="current"' : '';
$status_links[] = "<li><a href=\"edit.php\"$class>".__('All Posts')."</a>"; $status_links[] = "<li><a href='edit.php' $class>" . __('All Posts') . '</a>';
foreach ( $post_stati as $status => $label ) { foreach ( $post_stati as $status => $label ) {
$class = ''; $class = '';
if ( !in_array($status, $avail_post_stati) ) if ( !in_array( $status, $avail_post_stati ) )
continue; continue;
if ( empty($num_posts->$status) ) if ( empty( $num_posts->$status ) )
continue; continue;
if ( $status == $_GET['post_status'] ) if ( $status == $_GET['post_status'] )
$class = ' class="current"'; $class = ' class="current"';
$status_links[] = "<li><a href=\"edit.php?post_status=$status\"$class>" . $status_links[] = "<li><a href='edit.php?post_status=$status' $class>" .
sprintf(__ngettext($label[2][0], $label[2][1], $num_posts->$status), $num_posts->$status) . '</a>'; sprintf( __ngettext( $label[2][0], $label[2][1], $num_posts->$status ), number_format_i18n( $num_posts->$status ) ) . '</a>';
} }
echo implode(' |</li>', $status_links) . '</li>'; echo implode( ' |</li>', $status_links ) . '</li>';
unset($status_links); unset( $status_links );
?> ?>
</ul> </ul>

View File

@ -996,7 +996,7 @@ foreach ( $post_mime_types as $mime_type => $label ) {
if ( wp_match_mime_types($mime_type, $_GET['post_mime_type']) ) if ( wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
$class = ' class="current"'; $class = ' class="current"';
$type_links[] = "<li><a href='" . add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false)) . "'$class>" . sprintf(__ngettext($label[2][0], $label[2][1], $num_posts[$mime_type]), "<span id='$mime_type-counter'>{$num_posts[$mime_type]}</span>") . '</a>'; $type_links[] = "<li><a href='" . add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false)) . "'$class>" . sprintf(__ngettext($label[2][0], $label[2][1], $num_posts[$mime_type]), "<span id='$mime_type-counter'>" . number_format_i18n( $num_posts[$mime_type] ) . '</span>') . '</a>';
} }
echo implode(' | </li>', $type_links) . '</li>'; echo implode(' | </li>', $type_links) . '</li>';
unset($type_links); unset($type_links);

View File

@ -98,7 +98,7 @@ foreach ( $post_mime_types as $mime_type => $label ) {
$class = ' class="current"'; $class = ' class="current"';
$type_links[] = "<li><a href=\"upload.php?post_mime_type=$mime_type\"$class>" . $type_links[] = "<li><a href=\"upload.php?post_mime_type=$mime_type\"$class>" .
sprintf(__ngettext($label[2][0], $label[2][1], $num_posts[$mime_type]), $num_posts[$mime_type]) . '</a>'; sprintf(__ngettext($label[2][0], $label[2][1], $num_posts[$mime_type]), number_format_i18n( $num_posts[$mime_type] )) . '</a>';
} }
echo implode(' | </li>', $type_links) . '</li>'; echo implode(' | </li>', $type_links) . '</li>';
unset($type_links); unset($type_links);