Three forum threads for the same Q. Hmm…
As one of your forum posts noted, you can’t access post data outside The Loop with the regular template tags. I’d normally suggest using single_post_title(), but since you want title *and* author, we’ll do a little PHP.
First we need to “query” the post content:
$post = $wp_query->post;
Easy enough. Now you can now access the post’s title like so:
$post->post_title
Author info is little harder to come by, since only user ID is contained in the post table. You can use a little plugin of mine to pull it in, or use a single line that queries the database for it:
$author = $wpdb->get_var("SELECT user_nickname FROM $wpdb->users WHERE ID = '$post->post_author'");
This gets nickname for the author ID in $post->post_author. If you need a full name (i.e. first and last), you’ll need to select them from the row:
$author = $wpdb->get_row("SELECT user_firstname, user_lastname FROM $wpdb->users WHERE ID = '$post->post_author'");
then call the elements like so:
$author->user_firstname
$author->user_lastname
Now to pull it all together in a useful script (assuming nickname):
<title>
<?php if(is_single()) {
$post = $wp_query->post;
$author = $wpdb->get_var("SELECT user_nickname FROM $wpdb->users WHERE ID = '$post->post_author'");
echo "$author: $post->post_title >> ";
} ?>
<?php bloginfo('name'); ?>
</title>