mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Add sticky_class() template tag. see #7457
git-svn-id: https://develop.svn.wordpress.org/trunk@8637 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1523,14 +1523,16 @@ class WP_Query {
|
||||
}
|
||||
|
||||
// Fetch sticky posts that weren't in the query results
|
||||
$stickies__in = implode(',', array_map( 'absint', $sticky_posts ));
|
||||
$stickies = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.ID IN ($stickies__in)" );
|
||||
// TODO Make sure post is published or viewable by the current user
|
||||
foreach ( $stickies as $sticky_post ) {
|
||||
if ( 'publish' != $sticky_post->post_status )
|
||||
continue;
|
||||
array_splice($this->posts, $sticky_offset, 0, array($sticky_post));
|
||||
$sticky_offset++;
|
||||
if ( !empty($sticky_posts) ) {
|
||||
$stickies__in = implode(',', array_map( 'absint', $sticky_posts ));
|
||||
$stickies = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.ID IN ($stickies__in)" );
|
||||
// TODO Make sure post is published or viewable by the current user
|
||||
foreach ( $stickies as $sticky_post ) {
|
||||
if ( 'publish' != $sticky_post->post_status )
|
||||
continue;
|
||||
array_splice($this->posts, $sticky_offset, 0, array($sticky_post));
|
||||
$sticky_offset++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1759,4 +1761,4 @@ function setup_postdata($post) {
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
Reference in New Issue
Block a user