Add author support to wp_title(). Props graeme. fixes #1615
git-svn-id: http://svn.automattic.com/wordpress/trunk@3037 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
33404a070f
commit
42f144b4d9
|
@ -144,6 +144,8 @@ function wp_title($sep = '»', $display = true) {
|
||||||
$p = get_query_var('p');
|
$p = get_query_var('p');
|
||||||
$name = get_query_var('name');
|
$name = get_query_var('name');
|
||||||
$category_name = get_query_var('category_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 there's a category
|
||||||
if ( !empty($cat) ) {
|
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'");
|
$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 there's a month
|
||||||
if ( !empty($m) ) {
|
if ( !empty($m) ) {
|
||||||
$my_year = substr($m, 0, 4);
|
$my_year = substr($m, 0, 4);
|
||||||
|
|
Loading…
Reference in New Issue