WordPress.org

Make WordPress Core

Changeset 7941


Ignore:
Timestamp:
05/16/08 03:57:09 (7 years ago)
Author:
matt
Message:

get_queried_object should not return an array of terms, and wp_title should check is_tax. Hat tip: andy

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/general-template.php

    r7634 r7941  
    232232        $post = $wp_query->get_queried_object(); 
    233233        $title = strip_tags( apply_filters( 'single_post_title', $post->post_title ) ); 
     234    } 
     235 
     236    // If there's a taxonomy 
     237    if ( is_tax() ) { 
     238        $taxonomy = get_query_var( 'taxonomy' ); 
     239        $tax = get_taxonomy( $taxonomy ); 
     240        $tax = $tax->label; 
     241        $term = $wp_query->get_queried_object(); 
     242        $term = $term->name; 
     243        if ( 'right' == $seplocation ) 
     244            $title = "$term $sep $tax"; 
     245        else 
     246            $title = "$tax $sep $term"; 
    234247    } 
    235248 
  • trunk/wp-includes/query.php

    r7906 r7941  
    16111611            $slug = $this->get('term'); 
    16121612            $term = &get_terms($tax, array('slug'=>$slug)); 
    1613             if ( is_wp_error($term) ) 
     1613            if ( is_wp_error($term) || empty($term) ) 
    16141614                return $term; 
     1615            $term = $term[0]; 
    16151616            $this->queried_object = $term; 
    16161617            $this->queried_object_id = $term->term_id; 
Note: See TracChangeset for help on using the changeset viewer.