From ab5e695fe6ba36b2a7bcd7429cce8bc201d517a4 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Fri, 11 Nov 2005 00:48:31 +0000 Subject: [PATCH] Add author support to wp_title(). Props graeme. fixes #1615 git-svn-id: https://develop.svn.wordpress.org/trunk@3037 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/template-functions-general.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/wp-includes/template-functions-general.php b/wp-includes/template-functions-general.php index 1dea56f14e..ab388f82c5 100644 --- a/wp-includes/template-functions-general.php +++ b/wp-includes/template-functions-general.php @@ -144,6 +144,8 @@ function wp_title($sep = '»', $display = true) { $p = get_query_var('p'); $name = get_query_var('name'); $category_name = get_query_var('category_name'); + $author = get_query_var('author'); + $author_name = get_query_var('author_name'); // If there's a category if ( !empty($cat) ) { @@ -162,6 +164,16 @@ function wp_title($sep = '»', $display = true) { $title = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE category_nicename = '$category_name'"); } + // If there's an author + if ( !empty($author) ) { + $title = get_userdata($author); + $title = $title->display_name; + } + if ( !empty($author_name) ) { + // We do a direct query here because we don't cache by nicename. + $title = $wpdb->get_var("SELECT display_name FROM $wpdb->users WHERE user_nicename = '$author_name'"); + } + // If there's a month if ( !empty($m) ) { $my_year = substr($m, 0, 4); @@ -684,4 +696,4 @@ function rsd_link() { echo '\n"; } -?> \ No newline at end of file +?>