in WordPress

Automatically Insert Post Author Bio On All Posts

Author

As shown in a previous post you can automatically add custom content after all wordpress posts using Wordpress hooks. This is a perfect place to make sure you give your author credit for the post and display their information at the end of all posts. In this post I will explain you can use the same method as the previous post but use the get author functions to display the author bio.

Get Author Bio After Posts

You can get the author bio and other author information while inside the post loop. Copy the following into your functions.php page to display the author information after the post content.

function author_bio ($content=''){
    global $post;

    $content.="<div class='content_box' id='author_information'>\n";
    $content.="<h3>".get_the_author_meta("display_name")."</h3>\n";
    $content.= "<p>".get_the_author_meta("description")."</p>\n";
    $content.="</div>\n";

    return $content;
}

add_filter('the_content', 'author_bio');

The above snippet uses the Wordpress function get_the_author_meta(). This function requires parameters to show different types of data, here is a list of parameters which you can pass to this function. - user_login

  • user_pass
  • user_nicename
  • user_email
  • user_url
  • user_registered
  • user_activation_key
  • user_status
  • display_name
  • nickname
  • first_name
  • last_name
  • description
  • jabber
  • aim
  • yim
  • user_level
  • user_firstname
  • user_lastname
  • user_description
  • rich_editing
  • comment_shortcuts
  • admin_color
  • plugins_per_page
  • plugins_last_view
  • ID

Login to access all content on Paulund

Login here

Subscribe To The Weekly Newsletter

Get weekly updates to your email