Ticket #12588: 12588.2.diff
File 12588.2.diff, 1.8 KB (added by , 15 years ago) |
---|
-
wp-includes/query.php
145 145 * @param string|int $author Optional. Is current page this author. 146 146 * @return bool True if page is author or $author (if set). 147 147 */ 148 function is_author 148 function is_author($author = '') { 149 149 global $wp_query; 150 150 151 151 if ( !$wp_query->is_author ) … … 180 180 * @param string|array $category Optional. 181 181 * @return bool 182 182 */ 183 function is_category 183 function is_category($category = '') { 184 184 global $wp_query; 185 185 186 186 if ( !$wp_query->is_category ) … … 409 409 * @param mixed $page Either page or list of pages to test against. 410 410 * @return bool 411 411 */ 412 function is_page 412 function is_page($page = '') { 413 413 global $wp_query; 414 414 415 415 if ( !$wp_query->is_page ) … … 529 529 if ( !$wp_query->is_single ) 530 530 return false; 531 531 532 if ( empty( 532 if ( empty($post) ) 533 533 return true; 534 534 535 535 $post_obj = $wp_query->get_queried_object(); … … 552 552 * @since 1.5.0 553 553 * @uses $wp_query 554 554 * 555 * @param string|array $post_types Optional. Post type or types to check in current query. 555 556 * @return bool 556 557 */ 557 function is_singular( ) {558 function is_singular($post_types = '') { 558 559 global $wp_query; 559 560 560 return $wp_query->is_singular; 561 if ( empty($post_types) || !$wp_query->is_singular ) 562 return $wp_query->is_singular; 563 564 $post_obj = $wp_query->get_queried_object(); 565 566 return in_array($post_obj->post_type, (array) $post_types); 561 567 } 562 568 563 569 /** … … 1237 1243 * 1238 1244 * @param string|array $query 1239 1245 */ 1240 function parse_query($query 1246 function parse_query($query) { 1241 1247 if ( !empty($query) || !isset($this->query) ) { 1242 1248 $this->init(); 1243 1249 if ( is_array($query) )