Changeset 16003
- Timestamp:
- 10/27/2010 08:27:45 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/list-table-posts.php
r15958 r16003 22 22 * 23 23 * @since 3.1.0 24 * @var bool24 * @var int 25 25 * @access protected 26 26 */ … … 31 31 * 32 32 * @since 3.1.0 33 * @var bool33 * @var int 34 34 * @access private 35 35 */ 36 36 var $user_posts_count; 37 38 /** 39 * Holds the number of posts which are sticky. 40 * 41 * @since 3.1.0 42 * @var int 43 * @access private 44 */ 45 var $sticky_posts_count = 0; 37 46 38 47 function WP_Posts_Table() { … … 52 61 $this->user_posts_count = $wpdb->get_var( $wpdb->prepare( " 53 62 SELECT COUNT( 1 ) FROM $wpdb->posts 54 WHERE post_type = '%s'AND post_status NOT IN ( 'trash', 'auto-draft' )63 WHERE post_type = %s AND post_status NOT IN ( 'trash', 'auto-draft' ) 55 64 AND post_author = %d 56 65 ", $post_type, get_current_user_id() ) ); 57 66 58 if ( $this->user_posts_count && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) )67 if ( $this->user_posts_count && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) && empty( $_REQUEST['show_sticky'] ) ) 59 68 $_GET['author'] = get_current_user_id(); 69 } 70 71 if ( $sticky_posts = get_option( 'sticky_posts' ) ) { 72 $sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) ); 73 $this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND ID IN ($sticky_posts)", $post_type ) ); 60 74 } 61 75 … … 140 154 $total_posts -= $num_posts->$state; 141 155 142 $class = empty( $class) && empty($_REQUEST['post_status']) ? ' class="current"' : '';156 $class = empty( $class ) && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['show_sticky'] ) ? ' class="current"' : ''; 143 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>'; 144 158 … … 158 172 159 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>'; 174 } 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 ) ); 160 184 } 161 185 -
trunk/wp-admin/includes/post.php
r15940 r16003 854 854 } 855 855 856 if ( ! empty( $q['show_sticky'] ) ) 857 $query['post__in'] = (array) get_option( 'sticky_posts' ); 858 856 859 wp( $query ); 857 860 … … 921 924 add_filter('posts_where', '_edit_attachments_query_helper'); 922 925 923 wp( $q);926 wp( $q ); 924 927 925 928 if ( isset($q['detached']) ) -
trunk/wp-includes/classes.php
r15960 r16003 37 37 * @var array 38 38 */ 39 var $private_query_vars = array('offset', 'posts_per_page', 'posts_per_archive_page', 'showposts', 'nopaging', 'post_type', 'post_status', 'category__in', 'category__not_in', 'category__and', 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'tag_id', 'post_mime_type', 'perm', 'comments_per_page' );39 var $private_query_vars = array('offset', 'posts_per_page', 'posts_per_archive_page', 'showposts', 'nopaging', 'post_type', 'post_status', 'category__in', 'category__not_in', 'category__and', 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'tag_id', 'post_mime_type', 'perm', 'comments_per_page', 'post__in', 'post__not_in'); 40 40 41 41 /**
Note: See TracChangeset
for help on using the changeset viewer.