diff --git a/wp-content/themes/classic/index.php b/wp-content/themes/classic/index.php index d6ca2ca4f9..f0b6d693b5 100644 --- a/wp-content/themes/classic/index.php +++ b/wp-content/themes/classic/index.php @@ -6,7 +6,7 @@ get_header(); ',''); ?> -
+

@
diff --git a/wp-content/themes/default/index.php b/wp-content/themes/default/index.php index 6b692ce2bc..978a215246 100644 --- a/wp-content/themes/default/index.php +++ b/wp-content/themes/default/index.php @@ -6,7 +6,7 @@ -
+

diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 15b80bcd58..a0cc3088ca 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -160,6 +160,24 @@ function has_excerpt( $id = 0 ) { return ( !empty( $post->post_excerpt ) ); } +/** + * Echo "sticky" CSS class if a post is sticky + * + * {@internal Missing Long Description}} + * + * @package WordPress + * @subpackage Post + * @since 2.7 + * + * @param int $post_id An optional post ID + */ +function sticky_class( $post_id = null ) { + if ( !is_sticky($post_id) ) + return; + + echo " sticky"; +} + function wp_link_pages($args = '') { $defaults = array( 'before' => '

' . __('Pages:'), 'after' => '

', diff --git a/wp-includes/post.php b/wp-includes/post.php index 3c540f9b0e..4dc60e9694 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -763,7 +763,14 @@ function get_post_custom_values( $key = '', $post_id = 0 ) { * @param int $post_id A post ID * @return bool */ -function is_sticky($post_id) { +function is_sticky($post_id = null) { + global $id; + + $post_id = absint($post_id); + + if ( !$post_id ) + $post_id = absint($id); + $stickies = get_option('sticky_posts'); if ( !is_array($stickies) ) @@ -775,6 +782,7 @@ function is_sticky($post_id) { return false; } + /** * sanitize_post() - Sanitize every post field * diff --git a/wp-includes/query.php b/wp-includes/query.php index a98ca156df..ed614dba27 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -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; } -?> +?> \ No newline at end of file