From 2d8fa9ee213bda083f6a280b1c13eddc1deafee8 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 16 May 2008 03:57:09 +0000 Subject: [PATCH] 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 --- wp-includes/general-template.php | 13 +++++++++++++ wp-includes/query.php | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 763f414a6d..b5f87ed843 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -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 "; diff --git a/wp-includes/query.php b/wp-includes/query.php index c8a93dbb34..8fb273101f 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -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) {