0

I am using this filter to display guest author on post, but i want guest author's posts to appear in the author.php template also.

This is my guest author code (inside functions.php).

<?php
add_filter( 'the_author', 'guest_author_name' );
add_filter( 'get_the_author_display_name', 'guest_author_name' );
function guest_author_name( $name ) {
    global $post;

    $author = get_post_meta( $post->ID, 'guest-author', true );

    if ( $author )
        $name = $author;
    return $name;
}
?>

...and here is the author template: http://codex.wordpress.org/Author_Templates#Sample_Template_File

3
  • if you make a subscriber level user and assign the post to that user should be able to load his posts on author.php template..
    – Sisir
    Commented Oct 28, 2011 at 11:14
  • @Otto Please do a full edit, when editing a post. Edits are "expensive", which means, the question is transformed to a "community wiki" after too many edits. Thanks.
    – kaiser
    Commented Aug 31, 2012 at 0:52
  • @user8503/OP Please make use of the WYSIWYG editor when asking or answering. And please use upper-/lowercase characters. At least this isn't chat.
    – kaiser
    Commented Aug 31, 2012 at 0:52

1 Answer 1

1

Create a new user with a role such as subscriber so they cant do anything in the backend, and assign the post to that user. Doing this would be a lot easier than the hours of custom coding needed to get things working using your system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.