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

git-svn-id: http://svn.automattic.com/wordpress/trunk@7941 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
matt 2008-05-16 03:57:09 +00:00
parent 7b0c0703f5
commit 2d8fa9ee21
2 changed files with 15 additions and 1 deletions

View File

@ -233,6 +233,19 @@ function wp_title($sep = '»', $display = true, $seplocation = '') {
$title = strip_tags( apply_filters( 'single_post_title', $post->post_title ) );
}
// If there's a taxonomy
if ( is_tax() ) {
$taxonomy = get_query_var( 'taxonomy' );
$tax = get_taxonomy( $taxonomy );
$tax = $tax->label;
$term = $wp_query->get_queried_object();
$term = $term->name;
if ( 'right' == $seplocation )
$title = "$term $sep $tax";
else
$title = "$tax $sep $term";
}
$prefix = '';
if ( !empty($title) )
$prefix = " $sep ";

View File

@ -1610,8 +1610,9 @@ class WP_Query {
$tax = $this->get('taxonomy');
$slug = $this->get('term');
$term = &get_terms($tax, array('slug'=>$slug));
if ( is_wp_error($term) )
if ( is_wp_error($term) || empty($term) )
return $term;
$term = $term[0];
$this->queried_object = $term;
$this->queried_object_id = $term->term_id;
} else if ($this->is_posts_page) {