Index: general-template.php
===================================================================
--- general-template.php	(revision 15364)
+++ general-template.php	(working copy)
@@ -517,8 +517,9 @@
 	global $wpdb, $wp_locale, $wp_query;
 
 	$cat = get_query_var('cat');
+	$category_name = get_query_var('category_name');
 	$tag = get_query_var('tag_id');
-	$category_name = get_query_var('category_name');
+	$taxonomy = get_query_var('taxonomy');
 	$author = get_query_var('author');
 	$author_name = get_query_var('author_name');
 	$m = get_query_var('m');
@@ -548,6 +549,7 @@
 			$title = apply_filters('single_cat_title', $cat->name);
 	}
 
+	// If there's a tag
 	if ( !empty($tag) ) {
 		$tag = get_term($tag, 'post_tag', OBJECT, 'display');
 		if ( is_wp_error( $tag ) )
@@ -574,6 +576,7 @@
 		$title = $my_year . ($my_month ? $t_sep . $my_month : "") . ($my_day ? $t_sep . $my_day : "");
 	}
 
+	// If there's a year
 	if ( !empty($year) ) {
 		$title = $year;
 		if ( !empty($monthnum) )
@@ -590,7 +593,6 @@
 
 	// If there's a taxonomy
 	if ( is_tax() ) {
-		$taxonomy = get_query_var( 'taxonomy' );
 		$tax = get_taxonomy( $taxonomy );
 		$term = $wp_query->get_queried_object();
 		$term = $term->name;
@@ -603,6 +605,7 @@
 		$title = sprintf(__('Search Results %1$s %2$s'), $t_sep, strip_tags($search));
 	}
 
+	//If it's a 404 page
 	if ( is_404() ) {
 		$title = __('Page not found');
 	}
@@ -722,12 +725,13 @@
  */
 function single_tag_title($prefix = '', $display = true ) {
 	global $wp_query;
+
 	if ( !is_tag() )
 		return;
 
 	$tag = $wp_query->get_queried_object();
 
-	if ( ! $tag )
+	if ( !$tag )
 		return;
 
 	$my_tag_name = apply_filters('single_tag_title', $tag->name);
@@ -740,6 +744,43 @@
 }
 
 /**
+ * Display or retrieve page title for taxonomy term archive.
+ *
+ * Useful for taxonomy term template files for displaying the taxonomy term page title.
+ * It has less overhead than {@link wp_title()}, because of its limited implementation.
+ *
+ * It does not support placing the separator after the title, but by leaving the
+ * prefix parameter empty, you can set the title separator manually. The prefix
+ * does not automatically place a space between the prefix, so if there should
+ * be a space, the parameter value will need to have it at the end.
+ *
+ * @since 3.0.1
+ *
+ * @param string $prefix Optional. What to display before the title.
+ * @param bool $display Optional, default is true. Whether to display or retrieve title.
+ * @return string|null Title when retrieving, null when displaying or failure.
+ */
+function single_term_title($prefix = '', $display = true ) {
+	global $wp_query;
+
+	if ( !is_term() )
+		return;
+
+	$term = $wp_query->get_queried_object();
+
+	if ( !$term )
+		return;
+
+	$my_term_name = apply_filters('single_term_title', $term->name);
+	if ( !empty($my_term_name) ) {
+		if ( $display )
+			echo $prefix . $my_term_name;
+		else
+			return $my_term_name;
+	}
+}
+
+/**
  * Display or retrieve page title for post archive based on date.
  *
  * Useful for when the template only needs to display the month and year, if
