Ticket #7874: 7874.1.diff
File 7874.1.diff, 1.6 KB (added by , 15 years ago) |
---|
-
query.php
871 871 var $is_preview = false; 872 872 873 873 /** 874 * Set if query is a sticky post. 875 * 876 * @since 2.7.0 877 * @access public 878 * @var bool 879 */ 880 var $is_sticky = false; 881 882 /** 874 883 * Set if query returns a page. 875 884 * 876 885 * @since 1.5.0 … … 1089 1098 */ 1090 1099 function init_query_flags() { 1091 1100 $this->is_single = false; 1101 $this->is_sticky = false; 1092 1102 $this->is_page = false; 1093 1103 $this->is_archive = false; 1094 1104 $this->is_date = false; … … 2304 2314 // Loop over posts and relocate stickies to the front. 2305 2315 for ( $i = 0; $i < $num_posts; $i++ ) { 2306 2316 if ( in_array($this->posts[$i]->ID, $sticky_posts) ) { 2317 // Mark it 'sticky' so is_sticky() returns true 2318 $this->posts[$i]->is_sticky = true; 2319 // Gather the data for the sticky post 2307 2320 $sticky_post = $this->posts[$i]; 2308 2321 // Remove sticky from current position 2309 2322 array_splice($this->posts, $i, 1); … … 2382 2395 } 2383 2396 2384 2397 /** 2398 * Return if the post is stickyed or not. 2399 * 2400 * Returns true if post is considered sticky, false if not. 2401 * 2402 * @since 2.7.0 2403 * @access public 2404 * @uses $post 2405 * @uses do_action() Calls 'sticky_post'. 2406 */ 2407 function is_sticky() { 2408 global $post; 2409 if ( $post->is_sticky == 1 ) { 2410 do_action('sticky_post'); 2411 return true; 2412 } else { 2413 return false; 2414 } 2415 } 2416 2417 /** 2385 2418 * Whether there are more posts available in the loop. 2386 2419 * 2387 2420 * Calls action 'loop_end', when the loop is complete.