Top

Daily Tip: How to Rewrite Author Name on Post For a Guest Author

June 20, 2010

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:

<?php $author = get_post_meta($post->ID, "guest-author", true);

if ($author != "") {
    echo $author;
} else {

    the_author();
}  ?>

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

<?php the_author_url(); ?>

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

Tweet This Post


Comments

Got something to say?

Bottom
Article Archive  |  This site is a historical archive of pressography.com, a WordPress plugin and theme blog that published between 2006 and 2012. It is preserved for reference and is not operated by, affiliated with, or endorsed by its original authors. Nothing here is for sale and no form on this site is active. If you are the original owner and would like this domain returned, please get in touch.