Ticket #8466: 8466.diff
File 8466.diff, 3.9 KB (added by , 14 years ago) |
---|
-
wp-admin/includes/default-list-tables.php
24 24 * Holds the number of pending comments for each post 25 25 * 26 26 * @since 3.1.0 27 * @var bool27 * @var int 28 28 * @access protected 29 29 */ 30 30 var $comment_pending_count; … … 33 33 * Holds the number of posts for this user 34 34 * 35 35 * @since 3.1.0 36 * @var bool36 * @var int 37 37 * @access private 38 38 */ 39 39 var $user_posts_count; 40 40 41 /** 42 * Holds the number of posts which are sticky. 43 * 44 * @since 3.1.0 45 * @var int 46 * @access private 47 */ 48 var $sticky_posts_count; 49 41 50 function WP_Posts_Table() { 42 51 global $post_type_object, $post_type, $current_screen, $wpdb; 43 52 … … 58 67 AND post_author = %d 59 68 ", $post_type, get_current_user_id() ) ); 60 69 61 if ( $this->user_posts_count && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) )70 if ( $this->user_posts_count && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) && empty( $_REQUEST['show_sticky'] ) ) 62 71 $_GET['author'] = get_current_user_id(); 63 72 } 64 73 74 $this->sticky_posts_count = $post_type == 'post' ? count( (array) get_option( 'sticky_posts' ) ) : 0; 75 65 76 parent::WP_List_Table( array( 66 77 'screen' => $current_screen, 67 78 'plural' => 'posts', … … 142 153 foreach ( get_post_stati( array('show_in_admin_all_list' => false) ) as $state ) 143 154 $total_posts -= $num_posts->$state; 144 155 145 $class = empty( $class) && empty($_REQUEST['post_status']) ? ' class="current"' : '';156 $class = empty( $class ) && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['show_sticky'] ) ? ' class="current"' : ''; 146 157 $status_links['all'] = "<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>'; 147 158 148 159 foreach ( get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status ) { … … 161 172 162 173 $status_links[$status_name] = "<li><a href='edit.php?post_status=$status_name&post_type=$post_type'$class>" . sprintf( _n( $status->label_count[0], $status->label_count[1], $num_posts->$status_name ), number_format_i18n( $num_posts->$status_name ) ) . '</a>'; 163 174 } 164 175 176 if ( ! empty( $this->sticky_posts_count ) ) { 177 $class = ! empty( $_REQUEST['show_sticky'] ) ? ' class="current"' : ''; 178 179 $sticky_link = array( 'sticky' => "<li><a href='edit.php?post_type=$post_type&show_sticky=1'$class>" . sprintf( _nx( 'Sticky <span class="count">(%s)</span>', 'Sticky <span class="count">(%s)</span>', $this->sticky_posts_count, 'posts' ), number_format_i18n( $this->sticky_posts_count ) ) . '</a>' ); 180 181 // Sticky comes after Publish, or if not listed, after All. 182 $split = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ) ); 183 $status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) ); 184 } 185 165 186 return $status_links; 166 187 } 167 188 -
wp-admin/includes/post.php
853 853 $query['posts_per_archive_page'] = -1; 854 854 } 855 855 856 wp( $query ); 856 if ( ! empty( $q['show_sticky'] ) ) 857 $query['post__in'] = (array) get_option( 'sticky_posts' ); 857 858 859 query_posts( $query ); 860 858 861 return $avail_post_stati; 859 862 } 860 863 … … 920 923 if ( isset($q['detached']) ) 921 924 add_filter('posts_where', '_edit_attachments_query_helper'); 922 925 923 wp($q);926 query_posts( $q ); 924 927 925 928 if ( isset($q['detached']) ) 926 929 remove_filter('posts_where', '_edit_attachments_query_helper');