How to Rewrite Author Name on Post For a Guest Author

How to Rewrite Author Name on Post For a Guest Author

Ever want to post an article submitted to your blog by someone else? Here’s an easy way to post it yourself as admin and rewrite the author name to whatever you want on a case by case basis. Add this to your single.php and/or page.php file where you want the author name to show up:

{code type=php}
ID, “guest-author”, true);
if ($author != “”) {
echo $author;
} else {
the_author();
} ?>
{/code}

Ordinarily you would just replace this tag with the above code:

{code type=php}

{/code}

Now, when you want to add a guest author’s name to the post, simply create a custom field called guest-author and add the name of the author as the value of the field.

Source: WP Recipes