Changeset 8637
- Timestamp:
- 08/13/2008 06:21:52 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/classic/index.php
r7869 r8637 7 7 <?php the_date('','<h2>','</h2>'); ?> 8 8 9 <div class="post " id="post-<?php the_ID(); ?>">9 <div class="post<?php sticky_class(); ?>" id="post-<?php the_ID(); ?>"> 10 10 <h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3> 11 11 <div class="meta"><?php _e("Filed under:"); ?> <?php the_category(',') ?> — <?php the_tags(__('Tags: '), ', ', ' — '); ?> <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(__('Edit This')); ?></div> -
trunk/wp-content/themes/default/index.php
r6132 r8637 7 7 <?php while (have_posts()) : the_post(); ?> 8 8 9 <div class="post " id="post-<?php the_ID(); ?>">9 <div class="post<?php sticky_class(); ?>" id="post-<?php the_ID(); ?>"> 10 10 <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> 11 11 <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> -
trunk/wp-includes/post-template.php
r8600 r8637 159 159 $post = &get_post( $id ); 160 160 return ( !empty( $post->post_excerpt ) ); 161 } 162 163 /** 164 * Echo "sticky" CSS class if a post is sticky 165 * 166 * {@internal Missing Long Description}} 167 * 168 * @package WordPress 169 * @subpackage Post 170 * @since 2.7 171 * 172 * @param int $post_id An optional post ID 173 */ 174 function sticky_class( $post_id = null ) { 175 if ( !is_sticky($post_id) ) 176 return; 177 178 echo " sticky"; 161 179 } 162 180 -
trunk/wp-includes/post.php
r8636 r8637 764 764 * @return bool 765 765 */ 766 function is_sticky($post_id) { 766 function is_sticky($post_id = null) { 767 global $id; 768 769 $post_id = absint($post_id); 770 771 if ( !$post_id ) 772 $post_id = absint($id); 773 767 774 $stickies = get_option('sticky_posts'); 768 775 … … 775 782 return false; 776 783 } 784 777 785 778 786 /** -
trunk/wp-includes/query.php
r8600 r8637 1524 1524 1525 1525 // 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 } 1534 1536 } 1535 1537 }
Note: See TracChangeset
for help on using the changeset viewer.