Revert [15742]. Custom post types and sticky posts don't mix. fixes #12702.

git-svn-id: http://svn.automattic.com/wordpress/trunk@16680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-12-02 03:39:26 +00:00
parent e7140d23cb
commit 61a6e261c5
2 changed files with 8 additions and 8 deletions

View File

@ -68,7 +68,7 @@ class WP_Posts_List_Table extends WP_List_Table {
$_GET['author'] = get_current_user_id();
}
if ( $sticky_posts = get_option( 'sticky_posts' ) ) {
if ( 'post' == $post_type && $sticky_posts = get_option( 'sticky_posts' ) ) {
$sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) );
$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 ) );
}
@ -950,7 +950,7 @@ class WP_Posts_List_Table extends WP_List_Table {
</select>
</label>
<?php if ( post_type_supports( $screen->post_type, 'sticky' ) && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?>
<?php if ( 'post' == $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?>
<?php if ( $bulk ) : ?>
@ -967,12 +967,12 @@ class WP_Posts_List_Table extends WP_List_Table {
<label class="alignleft">
<input type="checkbox" name="sticky" value="sticky" />
<span class="checkbox-title"><?php _e( 'Make this sticky' ); ?></span>
<span class="checkbox-title"><?php _e( 'Make this post sticky' ); ?></span>
</label>
<?php endif; // $bulk ?>
<?php endif; // post_type_supports(sticky) && $can_publish && current_user_can( 'edit_others_cap' ) ?>
<?php endif; // 'post' && $can_publish && current_user_can( 'edit_others_cap' ) ?>
</div>

View File

@ -114,7 +114,7 @@ if ( 'private' == $post->post_status ) {
} elseif ( !empty( $post->post_password ) ) {
$visibility = 'password';
$visibility_trans = __('Password protected');
} elseif ( post_type_supports( $post->post_type, 'sticky' ) && is_sticky( $post->ID ) ) {
} elseif ( $post_type == 'post' && is_sticky( $post->ID ) ) {
$visibility = 'public';
$visibility_trans = __('Public, Sticky');
} else {
@ -128,15 +128,15 @@ echo esc_html( $visibility_trans ); ?></span>
<div id="post-visibility-select" class="hide-if-js">
<input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr($post->post_password); ?>" />
<?php if ( post_type_supports( $post->post_type, 'sticky' ) ): ?>
<?php if ($post_type == 'post'): ?>
<input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked(is_sticky($post->ID)); ?> />
<?php endif; ?>
<input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" />
<input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e('Public'); ?></label><br />
<?php if ( post_type_supports( $post->post_type, 'sticky' ) ): ?>
<span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked(is_sticky($post->ID)); ?> tabindex="4" /> <label for="sticky" class="selectit"><?php _e('Stick this to the front page') ?></label><br /></span>
<?php if ($post_type == 'post'): ?>
<span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked(is_sticky($post->ID)); ?> tabindex="4" /> <label for="sticky" class="selectit"><?php _e('Stick this post to the front page') ?></label><br /></span>
<?php endif; ?>
<input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e('Password protected'); ?></label><br />
<span id="password-span"><label for="post_password"><?php _e('Password:'); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo esc_attr($post->post_password); ?>" /><br /></span>