Ticket #9582: my_posts_filter.patch
| File my_posts_filter.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 $post_filters = 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 $post_filters[] = "<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 $post_filters[] = "<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 $post_filters[] = "<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 $post_filters = apply_filters('edit_posts_filters', $post_filters); 165 166 foreach ( $post_filters as $i => $post_filter ) { 167 $post_filters[$i] = '<li>' . $post_filter; 168 } 169 170 echo implode( " |</li>\n", $post_filters ) . '</li>'; 171 unset( $post_filters ); 162 172 endif; 163 173 ?> 164 174 </ul>