Changeset 13787
- Timestamp:
- 03/21/2010 02:52:00 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/query.php
r13774 r13787 95 95 * @return bool True if page is archive. 96 96 */ 97 function is_archive 97 function is_archive() { 98 98 global $wp_query; 99 99 … … 109 109 * @return bool True if page is attachment. 110 110 */ 111 function is_attachment 111 function is_attachment() { 112 112 global $wp_query; 113 113 … … 269 269 * @return bool 270 270 */ 271 function is_comments_popup 271 function is_comments_popup() { 272 272 global $wp_query; 273 273 … … 283 283 * @return bool 284 284 */ 285 function is_date 285 function is_date() { 286 286 global $wp_query; 287 287 … … 297 297 * @return bool 298 298 */ 299 function is_day 299 function is_day() { 300 300 global $wp_query; 301 301 … … 311 311 * @return bool 312 312 */ 313 function is_feed 313 function is_feed() { 314 314 global $wp_query; 315 315 … … 325 325 * @return bool 326 326 */ 327 function is_comment_feed 327 function is_comment_feed() { 328 328 global $wp_query; 329 329 … … 340 340 * @return bool True, if front of site. 341 341 */ 342 function is_front_page 342 function is_front_page() { 343 343 // most likely case 344 344 if ( 'posts' == get_option('show_on_front') && is_home() ) … … 362 362 * @return bool True if blog view homepage. 363 363 */ 364 function is_home 364 function is_home() { 365 365 global $wp_query; 366 366 … … 376 376 * @return bool 377 377 */ 378 function is_month 378 function is_month() { 379 379 global $wp_query; 380 380 … … 430 430 * @return bool 431 431 */ 432 function is_paged 432 function is_paged() { 433 433 global $wp_query; 434 434 … … 492 492 * @return bool 493 493 */ 494 function is_search 494 function is_search() { 495 495 global $wp_query; 496 496 … … 513 513 * @return bool 514 514 */ 515 function is_single 515 function is_single($post = '') { 516 516 global $wp_query; 517 517 … … 558 558 * @return bool 559 559 */ 560 function is_time 560 function is_time() { 561 561 global $wp_query; 562 562 … … 572 572 * @return bool 573 573 */ 574 function is_trackback 574 function is_trackback() { 575 575 global $wp_query; 576 576 … … 586 586 * @return bool 587 587 */ 588 function is_year 588 function is_year() { 589 589 global $wp_query; 590 590 … … 600 600 * @return bool True, if nothing is found matching WordPress Query. 601 601 */ 602 function is_404 602 function is_404() { 603 603 global $wp_query; 604 604 … … 1135 1135 * @access public 1136 1136 */ 1137 function init 1137 function init() { 1138 1138 unset($this->posts); 1139 1139 unset($this->query); … … 1228 1228 * @param string|array $query 1229 1229 */ 1230 function parse_query 1230 function parse_query($query) { 1231 1231 if ( !empty($query) || !isset($this->query) ) { 1232 1232 $this->init(); … … 1997 1997 $taxonomy = $q['taxonomy']; 1998 1998 $tt[$taxonomy] = $q['term']; 1999 $terms = get_terms($q['taxonomy'], array('slug'=>$q['term']));2000 1999 } else { 2001 2000 foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) { 2002 2001 if ( $t->query_var && '' != $q[$t->query_var] ) { 2003 $terms = get_terms($taxonomy, array('slug'=>$q[$t->query_var])); 2004 if ( !is_wp_error($terms) ) 2005 break; 2002 $tt[$taxonomy] = $q[$t->query_var]; 2003 break; 2006 2004 } 2007 2005 } 2008 2006 } 2007 2008 $terms = get_terms($taxonomy, array('slug' => $tt[$taxonomy], 'hide_empty' => !is_taxonomy_hierarchical($taxonomy))); 2009 2009 2010 if ( is_wp_error($terms) || empty($terms) ) { 2010 2011 $whichcat = " AND 0 "; 2011 2012 } else { 2012 foreach ( $terms as $term ) 2013 foreach ( $terms as $term ) { 2013 2014 $term_ids[] = $term->term_id; 2015 if ( is_taxonomy_hierarchical($taxonomy) ) { 2016 $children = get_term_children($term->term_id, $taxonomy); 2017 $term_ids = array_merge($term_ids, $children); 2018 } 2019 } 2014 2020 $post_ids = get_objects_in_term($term_ids, $taxonomy); 2015 if ( !is_wp_error($post_ids) && count($post_ids) ) {2021 if ( !is_wp_error($post_ids) && !empty($post_ids) ) { 2016 2022 $whichcat .= " AND $wpdb->posts.ID IN (" . implode(', ', $post_ids) . ") "; 2017 2023 $post_type = 'any'; … … 2735 2741 * @return WP_Query 2736 2742 */ 2737 function WP_Query 2743 function WP_Query($query = '') { 2738 2744 if (! empty($query)) { 2739 2745 $this->query($query); … … 2753 2759 * @return null If no link is found, null is returned. 2754 2760 */ 2755 function wp_old_slug_redirect 2761 function wp_old_slug_redirect() { 2756 2762 global $wp_query; 2757 2763 if ( is_404() && '' != $wp_query->query_vars['name'] ) : … … 2827 2833 return true; 2828 2834 } 2829 2830 2835 ?>
Note: See TracChangeset
for help on using the changeset viewer.