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
This commit is contained in:
parent
4daed6d8b9
commit
ab5e695fe6
|
@ -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);
|
||||||
|
@ -684,4 +696,4 @@ function rsd_link() {
|
||||||
echo '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="' . get_bloginfo('url') . "/xmlrpc.php?rsd\" />\n";
|
echo '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="' . get_bloginfo('url') . "/xmlrpc.php?rsd\" />\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue