Post Pic

Rewrite author name with custom field

In my other blog Cats Who Blog, I have demonstrated how being a guest blogger is definitely a great way to gain new readers. In order to give your guest authors some credits, you should definitely implement this easy tip.

Nothing hard with this recipe: Simply paste the following code on your single.php and page.php, where you want the author name to be displayed.

<?php $author = get_post_meta($post->ID, "guest-author", true);
if ($author != "") {
    echo $author;
} else {
    the_author();
}  ?>

Once done, you just have to create a custom field named guest-author and type your custom title as a value.

Leave a Comment

* Name, Email, Comment are Required

WP Theme of the week

Sponsored Likebox