Make WordPress Core


Ignore:
Timestamp:
08/13/2008 06:21:52 PM (17 years ago)
Author:
ryan
Message:

Add sticky_class() template tag. see #7457

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/query.php

    r8600 r8637  
    15241524
    15251525            // Fetch sticky posts that weren't in the query results
    1526             $stickies__in = implode(',', array_map( 'absint', $sticky_posts ));
    1527             $stickies = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.ID IN ($stickies__in)" );
    1528             // TODO Make sure post is published or viewable by the current user
    1529             foreach ( $stickies as $sticky_post ) {
    1530                 if ( 'publish' != $sticky_post->post_status )
    1531                     continue;
    1532                 array_splice($this->posts, $sticky_offset, 0, array($sticky_post));
    1533                 $sticky_offset++;
     1526            if ( !empty($sticky_posts) ) {
     1527                $stickies__in = implode(',', array_map( 'absint', $sticky_posts ));
     1528                $stickies = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.ID IN ($stickies__in)" );
     1529                // TODO Make sure post is published or viewable by the current user
     1530                foreach ( $stickies as $sticky_post ) {
     1531                    if ( 'publish' != $sticky_post->post_status )
     1532                        continue;
     1533                        array_splice($this->posts, $sticky_offset, 0, array($sticky_post));
     1534                        $sticky_offset++;
     1535                }
    15341536            }
    15351537        }
Note: See TracChangeset for help on using the changeset viewer.