How to Display Author Bio Excerpt in WordPress

x theme
(Last Updated On: July 10, 2014)

We know how to display excerpt for post content. But there is a possibility you also want excerpts for author biographies at the end of a post.


By following up this tutorial, you will be able to display a short info of the author bio. Paste the code snippet below inside your functions.php.

   function author_short_info() {
      $text_limit = 15; //Words to show in author bio excerpt
      $read_more  = "Read more"; //Read more text
      $end_of_txt = "...";
      $name_of_author = get_the_author();
      $url_of_author  = get_author_posts_url(get_the_author_meta('ID'));
      $short_desc_author = wp_trim_words(strip_tags(
                          get_the_author_meta('description')), $text_limit, 
                          $end_of_txt.'<br/>'. $read_more. 
                        '<a href="'.$url_of_author.'">'.$name_of_author.'</a>');

      return $short_desc_author;

Now you’ll have to use this function inside function. Call it inside your single.php or anywhere else inside the loop.

     if (function_exists('author_short_info'))
        echo author_short_info();

About the author


Leave a Reply

Your email address will not be published. Required fields are marked *