If you are regular reader of this site than you know I change the theme about as often as I change my socks. This site is more than a marketing and design resource for my readers, it is also a design and usability testing playground for me! And as you may have noticed, the site has undergone a few new layout changes today.
There is one in particular change that I would like to discuss further, adding an author bio to post pages. While this is not in itself a difficult change or anything that would normally warrant a post, I had to make a minor change to the core WordPress code to allow HTML markup in the author bio field.
I wanted to add an author box below my posts that included the author bio from the administration area, but I wanted to use HTML in the bio. When I first tried to add HTML to my bio, I found that HTML markup is stripped when by WordPress by default. This default action by WordPress made it impossible to add links and images or other rich content to the biography field for authors.
To solve this problem, I found a bypass that will allow WordPress to accept HTML markup in the bio.
To do this, you need to open and edit the file: /wp-includes/registration.php
Do a search for the following line of code:
$description = apply_filters(‘pre_user_description’, $description);
You need to comment out that line. This is done by adding a // to the start of the line, like this:
//$description = apply_filters(‘pre_user_description’, $description);
This will stop WordPress from filtering out your HTML in the author bio field.
Next, you will need to add a caller to your template that pulls the author description. To do this, simply add the following line of code to your template where you wish to display the author bio content:
<?php the_author_description(); ?>
In my case I placed this line within a SPAN that I styled to match the appearance of my site.
You can see it in action below!