• Catalyticat
  • So how does the cat err, catalyze stuff?

    Not sure, but I like the way the word rolls off your tongue...cat-a-ly-ti-cat

    Anyway, this website is basically a brain dump for my thoughts, designs and writing.
    So have a look around and I hope you find something interesting.

    And I enjoy getting comments so please feel free to leave one. ;)

    - Sean Ockert

  • My narcissistic music corner

    The bands on repeat on my iPod are Nine Inch Nails and The Tea Party. I'm praying that Nine Inch Nails does a stand alone concert in Brisbane but I fear that I might just have to cave in and get a ticket to Soundwaves in Feb.

    Also, there's 2 incredible Aussie bands that deserve so much more attention than they recieve:
    The Butterfly Effect and Mammal.

    The Leonard Cohen concert was fantastic. An epic 3 hour show that I hope won't be his last.

 
 

Search




Recent Posts

Random Post...

Archives

Posts Tagged ‘wordpress’


Jun
08

Adding a biography to your Wordpress posts

On news and article sites you often see a little biography about the author, just before the comment section. I wanted to have this for a Wordpress site while keeping it as simple as possible for the author.

The Biographical Info field in the author’s profile would seem the logical choice but it only accepts plain text, whereas I wanted links as well. So instead, here is a quick way to display the author’s biography using a Wordpress Custom Field.

In your theme, open up single.php and after <div class="entry">...</div>, add the following (sorry about the borked layout):


<?php if (get_post_meta($post->ID, 'Bio', true) ): // Only show if Bio key is set ?>
<div class="author">
<span class="gravatar">
<?php echo get_avatar( get_the_author_email(), '40' ); // Display the author's gravatar at 40x40px ?>
</span>
<div class="bio">
<h3>Author: <?php the_author_nickname(); // Can use the_author() instead ?></h3>
<p><?php echo get_post_meta($post->ID, 'Bio', true); // Show Bio ?></p>
</div>
</div>
<?php endif; ?>

Add some CSS to the box to float the author’s picture and tie in with your blog theme:

<style>
.author {margin-top:10px;padding:10px;border:1px solid #EECF9F;background-color:#FDF4E5;}
.author h3 {color:#513810;margin-left:6px;}
.gravatar{margin-right:10px;float:left;}
.bio {margin-left:45px;}

</style>

Now when you’re writing a post, add a new custom field with the Name Bio and type a little bit about the author in the Value field (the author box will only show on the post if there is a Bio custom field). Publish or update the post and that’s it! Below your post you should now have something like:

Example of an author biography using custom fields in Wordpress

Extra:
1. In your post template, you could change the line Posted by author to an anchor link for the bio box instead i.e. Posted by <a href="#author">author</a>.

2. If you don’t want to have multiple registered Wordpress users but still want to have different contributing authors with a biography for each, try combining with this function. It allows you to define a guest author as a Custom Field.

Tags: , , ,

^