Ticket #9582: my_posts_link.patch
| File my_posts_link.patch, 2.6 KB (added by , 17 years ago) |
|---|
-
home/cristi/svn/wp/wp-admin/edit.php
82 82 $parent_file = 'edit.php'; 83 83 wp_enqueue_script('inline-edit-post'); 84 84 85 list($post_stati, $avail_post_stati) = wp_edit_posts_query();86 87 85 require_once('admin-header.php'); 88 86 89 87 if ( !isset( $_GET['paged'] ) ) … … 137 135 <ul class="subsubsub"> 138 136 <?php 139 137 if ( empty($locked_post_status) ) : 140 $ status_links = array();138 $edit_posts_links = array(); 141 139 $num_posts = wp_count_posts( 'post', 'readable' ); 142 140 $total_posts = array_sum( (array) $num_posts ); 143 $class = empty( $_GET['post_status']) ? ' class="current"' : '';144 $ status_links[] = "<li><a href='edit.php' $class>" . sprintf( _n( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts ), number_format_i18n( $total_posts ) ) . '</a>';141 $class = ( count( $_GET ) <= 1 ) ? ' class="current"' : ''; 142 $edit_posts_links[] = "<a href='edit.php' $class>" . sprintf( _n( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts ), number_format_i18n( $total_posts ) ) . '</a>'; 145 143 144 global $user_ID, $wpdb; 145 $class = ( $_GET['author'] == $user_ID ) ? ' class="current"' : ''; 146 $my_posts_count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_author = $user_ID"); 147 $edit_posts_links[] = "<a href='edit.php?author=$user_ID' $class>" . __('My posts') . sprintf(' <span class="count">(%s)</span></a>', number_format_i18n($my_posts_count) ); 146 148 149 list($post_stati, $avail_post_stati) = wp_edit_posts_query(); 147 150 foreach ( $post_stati as $status => $label ) { 148 151 $class = ''; 149 152 … … 155 158 if ( isset($_GET['post_status']) && $status == $_GET['post_status'] ) 156 159 $class = ' class="current"'; 157 160 158 $ status_links[] = "<li><a href='edit.php?post_status=$status' $class>" . sprintf( _n( $label[2][0], $label[2][1], $num_posts->$status ), number_format_i18n( $num_posts->$status ) ) . '</a>';161 $edit_posts_links[] = "<a href='edit.php?post_status=$status' $class>" . sprintf( _n( $label[2][0], $label[2][1], $num_posts->$status ), number_format_i18n( $num_posts->$status ) ) . '</a>'; 159 162 } 160 echo implode( " |</li>\n", $status_links ) . '</li>'; 161 unset( $status_links ); 163 164 $edit_posts_links = apply_filters('edit_posts_links', $edit_posts_links); 165 166 foreach ( $edit_posts_links as $i => $post_link ) { 167 $edit_posts_links[$i] = '<li>' . $post_link; 168 } 169 170 echo implode( " |</li>\n", $edit_posts_links ) . '</li>'; 171 unset( $edit_posts_links ); 162 172 endif; 163 173 ?> 164 174 </ul>