Index: wp-includes/general-template.php
===================================================================
--- wp-includes/general-template.php	(revision 18623)
+++ wp-includes/general-template.php	(working copy)
@@ -617,6 +617,143 @@
 }
 
 /**
+ * Display <title> tag with contents
+ * 
+ * Possible arguments:
+ * 'sep' string, for the separator used in title tags
+ * 'home-title' string, for the homepage title. Only used for the blog page when the blog page is also the frontpage.
+ * 'frontpage-title' string, for the front page when it's not the posts page.
+ * 'show-sitename' boolean, defaults to true. When set to false the site name will not be added to titles.
+ *
+ * @since 3.3
+ * 
+ * @param string|array $args Optional. Override defaults.
+ */
+function wp_title_tag( $args = '' ) {
+	// Allow early filtering, if this returns a title skip all the logic below and print it, if it returns false, bail completely
+	if ( null !== $pre = apply_filters( 'pre_wp_title_tag', null ) ) {
+		if ( $pre )
+			echo '<title>' . $pre . "<title>\n";
+		return;
+	}
+
+	$defaults = array(
+		'sep'				=> '-',
+		'home-title'		=> false,
+		'frontpage-title'	=> false,
+		'show-sitename' 	=> true,
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+	
+	global $page, $paged, $wp_locale;
+	
+	$title = array();
+	
+	if ( is_home() && is_front_page() ) {
+		if ( $r['home-title'] ) {
+			$title[] = $r['home-title'];
+		} else {
+			$title[] = get_bloginfo('name');
+
+			// Add a page number if necessary:
+			if ( $paged >= 2 || $page >= 2 )
+				$title[] = sprintf( __( 'Page %s' ), max( $paged, $page ) );
+
+			if ( '' != $desc = get_bloginfo( 'description', 'display' ) )
+				$title[] = $desc; 
+		}
+	// If we're on the blog page and that page is not the homepage, use the container page's title
+	} elseif ( is_home() && !is_front_page() ) {
+		$_post = get_post( get_option('page_for_posts') );
+		$title[] = $_post->post_title;
+
+		// Add a page number if necessary:
+		if ( $paged >= 2 || $page >= 2 )
+			$title[] = sprintf( __( 'Page %s' ), max( $paged, $page ) );
+
+		if ( $r['show-sitename'] )
+			$title[] = get_bloginfo('name');
+	} elseif ( !is_home() && is_front_page() ) {
+		if ( $r['frontpage-title'] ) {
+			$title[] = $r['frontpage-title'];
+		} else {
+			$title[] = single_post_title( '', false );
+
+			if ( $r['show-sitename'] )
+				$title[] = get_bloginfo('name');
+		}
+	} else {
+		// If we're on a post / page
+		if ( is_singular() ) {
+			$title[] = single_post_title( '', false );
+		}
+		
+		// If we're on a category or tag archive
+		elseif ( is_category() || is_tag() ) {
+			$title[] = single_term_title( '', false );
+		}
+		
+		// If we're on a taxonomy archive
+		elseif ( is_tax() ) {
+			$term = get_queried_object();
+			$tax = get_taxonomy( $term->taxonomy );
+			$title[] = single_term_title( $tax->labels->name, false );
+		}
+
+		// If we're on an author archive
+		elseif ( is_author() ) {
+			$author = get_queried_object();
+			$title[] = $author->display_name;
+		}
+
+		// If we're on a post type archive
+		elseif ( is_post_type_archive() ) {
+			$title[] = post_type_archive_title( '', false );
+		}
+		
+		// If it's a date archive
+		elseif ( is_date() ) {
+			$month 	= get_query_var('monthnum');
+			$day 	= get_query_var('day');
+
+			$t = '';
+			if ( !empty($month) ) {
+				$month = $wp_locale->get_month($month);
+				if ( !empty($day) )
+					$t .= zeroise($day, 2) . ' ';
+				$t .= $month . ' ';
+			} 
+			$title[] = $t . get_query_var('year');
+		}
+
+		// If it's a search
+		elseif ( is_search() ) {
+			/* translators: 1: search phrase */
+			$title[] = sprintf(__('Search Results for "%1$s"'), strip_tags( get_query_var('s') ) );
+		}
+
+		// If it's a 404 page
+		elseif ( is_404() ) {
+			$title[] = __('Page not found');
+		}
+		
+		// Add a page number if necessary:
+		if ( $paged >= 2 || $page >= 2 )
+			$title[] = sprintf( __( 'Page %s' ), max( $paged, $page ) );
+		
+		if ( $r['show-sitename'] )
+			$title[] = get_bloginfo('name');
+	}
+	$title = apply_filters( 'wp_title_tag_array', $title );	
+
+	$title = implode( " ".$r['sep']." ", $title );
+	
+	$title = apply_filters( 'wp_title_tag', $title, $r['sep'] );	
+	echo "<title>" . $title . "</title>\n";
+}
+
+/**
  * Display or retrieve page title for post.
  *
  * This is optimized for single.php template file for displaying the post title.
Index: wp-content/themes/twentyeleven/header.php
===================================================================
--- wp-content/themes/twentyeleven/header.php	(revision 18623)
+++ wp-content/themes/twentyeleven/header.php	(working copy)
@@ -24,27 +24,7 @@
 <head>
 <meta charset="<?php bloginfo( 'charset' ); ?>" />
 <meta name="viewport" content="width=device-width" />
-<title><?php
-	/*
-	 * Print the <title> tag based on what is being viewed.
-	 */
-	global $page, $paged;
-
-	wp_title( '|', true, 'right' );
-
-	// Add the blog name.
-	bloginfo( 'name' );
-
-	// Add the blog description for the home/front page.
-	$site_description = get_bloginfo( 'description', 'display' );
-	if ( $site_description && ( is_home() || is_front_page() ) )
-		echo " | $site_description";
-
-	// Add a page number if necessary:
-	if ( $paged >= 2 || $page >= 2 )
-		echo ' | ' . sprintf( __( 'Page %s', 'twentyeleven' ), max( $paged, $page ) );
-
-	?></title>
+<?php wp_title_tag( array( 'sep' => '|' ) ); ?>
 <link rel="profile" href="http://gmpg.org/xfn/11" />
 <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
 <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
