Forums

Is it possible to have Custom Authors for a post? (5 posts)

  1. djstelios
    Member
    Posted 2 years ago #

    There are many posts on my blog, written by more than 1 people and other posts are send to me by email to post them by people they don't have the ability, the knowledge and/or they don't want to, post them online at the wordpress editor.

    Till now for every post I had to create a "fake" contributor, just to have his name at the authors list.
    But when I have a post, written by 2 or more people, I have problem to give the credits at the author.

    Is there, any way to write a "custom" author's name at a field, if it is not available in the dropdown list of the "Post Edit"???

  2. Dagon Design
    Member
    Posted 2 years ago #

    You could use custom fields for the posts, and add in some code to display them.

    One simpler option might be to comment out the code your theme uses to display the post author, and just write it in yourself at the bottom of the posts.

  3. djstelios
    Member
    Posted 2 years ago #

    Great idea Dagon Design!! I never thought a solution based on custom fields. I'll change the theme code to check if there is the custom field and if yes I'll display the custom field else I'll display the normal author name.

    Great. Thank you!

  4. djstelios
    Member
    Posted 2 years ago #

    I did it in 7 lines of code. It was so simple!

    Just in case, someone is interested on the solution, here's the function i wrote:

    function custom_get_author() {
      $authorName = get_post_meta(get_the_id(), "author", $single = true);
      if (trim($authorName) == "") {
        $authorName = get_the_author();
      }
      echo $authorName;
    }

    Just add a custom field named author and replace the standard wordpress function the_author() with custom_get_author();

    Dragon Design, thanks again for the idea.

  5. Shane G
    Member
    Posted 2 years ago #

    Hi,

    Refer this post:

    http://wordpress.org/support/topic/203668?replies=14

    Thanks,

    Shane G.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags