DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

Would you like to be able to show a short intro of the author bio instead of his complete bio? Here’s a code snippet to make an excerpt of the bio, with a link to the author page, where you can show the full bio.

Let’s start by creating the function. The code below have to be pasted into your functions.php file.

	function author_excerpt (){	                     					
		$word_limit = 20; // Limit the number of words
		$more_txt = 'read more about:'; // The read more text
		$txt_end = '...'; // Display text end 
		$authorName = get_the_author();
		$authorUrl = get_author_posts_url( get_the_author_meta('ID'));
		$authorDescriptionShort = wp_trim_words(strip_tags(get_the_author_meta('description')), $word_limit, $txt_end.'<br /> '.$more_txt.' <a href="'.$authorUrl.'">'.$authorName.'</a>');
		return $authorDescriptionShort; 		

Once done, you can use the function. To do so, use the code below where you’d like to display an author bio excerpt:

<?php  if (function_exists('author_excerpt')){echo author_excerpt();} ?>

Thanks to Tim Marcher for submitting this recipe!

Leave a Comment

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