• Home
  • New Entries
  • Popular Entries
  • Submit a Story
  • About

Optimise Your WordPress Themes With Better Author Pages ...

Recently Ajay D’Souza asked how we made our author archive pages here on BloggingPro. I personally am a big fan of displaying content differently on different sections of blogs and also think that archives should be more informative than be just a collection of excerpts.

Because I personally believe that an ‘Author Information’ block below every entry overkill is, the author archive is the right spot to display more information about every author and also display the entries written by authors in a short and concise way.


Part 1: Adding The Author Description and Gravatar

Creating customised author pages is really simple. Other than some CSS customisation the code for the author description is entirely provided by known and documented WordPress template tags and information gathered from the author profile.

First we need of course a author.php template for this to work and you need to make sure that every author fills in their profile. The code used in following code samples is backwards compatible (to WP1.2!) and makes use of the $ curauth functions documented in the WordPress Codex Author Templates. The email address is protected from spam harvesters.

01 <p class="listhead">You are in the <b>Author Archive</b></p>
02 
03     <!-- This sets the $curauth variable -->
04     <?php
05     if(isset($_GET[author_name])) :
06     $curauth = get_userdatabylogin($author_name);
07     else :
08     $curauth = get_userdata(intval($author));
09     endif;
10     ?>
11 
12     <div class="post">
13 
14     <h2><?php echo $curauth->first_name; ?> <?php echo $curauth->last_name; ?></h2>
15     <blockquote><?php echo $curauth->user_description; ?></blockquote>
16 
17     <h3>Information</h3>
18     <div class="right"><?php echo get_avatar( $curauth->user_email, 56 ); ?></div>
19         <ul>
20             <li>E-mail: <strong><a href="mailto:<?php echo antispambot($curauth->user_email); ?>">email author</a></strong></li>
21             <li>Website: <strong><a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a></strong></li>
22             <li>The avatar to the right is my gravatar. <a href="http://gravatar.com" title="Get your own!">Get your own!</a></li>
23         </ul>

You can now easily style this further with CSS.
Part Two: Adding List of Entries Written by The Author

The second part of the author pages is lots simpler and nothing more than a customised loop. Rather a loop without the excerpts.

01 <h3>Browse Updates by The Author</h3>
02     <ul>
03     <!-- The Loop -->
04     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
05           <li>
06           <strong><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></strong><br />
07           <small>Filed as <?php the_category(, ); ?> on <?php the_time(j/n Y); ?> <?php the_time(H:i); ?> with <?php comments_popup_link( o comments, 1 comment, \% comments); ?></small>
08           </li>
09     <?php endwhile; ?>
10     </ul>


That’s It. Almost

All there is left to do now is to add the Previous/Next navigation and provide a fallback option for when the author hasn’t published any entries yet.

01 <div class="navigation">
02     <div class="left"><?php next_posts_link(&larr; Previous Entries) ?></div>
03     <div class="right"><?php previous_posts_link(Next Entries &rarr;) ?></div>
04 </div>
05 
06       <?php else: ?>
07       <p><?php _e(No posts published yet!); ?></p>
08 
09     <?php endif; ?>
10     <!-- End Loop -->
11 </div>

 Original Source:
http://www.bloggingpro.com/archives/2010/01/19/optimise-your-wordpress-themes-with-better-author-pages/

AddThis Social Bookmark Button

Posted at 01:08:12 pm | Permalink | Posted in Wordpress Themes  

Related Stuff

Google Buzz Button Wordpress Plugin Released

If you are looking for a Google Buzz button to add into your Wordpress site then we have released the first Wordpress plugin exclusively ...

Plug And Play Ecommerce With Wordpress Plugins

Since 2003 Wordpress has slowly been gaining popularity amongst the elite of the internet, the bloggers. It is one of those few things ...

Add Google Search to Your WordPress Blog

The native WordPress search does not return very relevant results, thus it makes a lot of sense to add Google Search into your WordPress ...

Add More Sidebars to Your WordPress Theme

You can add more than one sidebar section to your WordPress site. For example, with the stc-intermountain.org site, I added a whole bunch ...

Series Posting in Wordpress

In my functions.php file, I have some code which implements series posting. This relies on the thematic ...

Top Stuff

Free Blogger templates Anime Themes

Wordpress Guestbook Generator Plugin

48 Unique Ways To Use WordPress

GeekLog

WordPress Single Post Templates

Get The Image WordPress Plugin



About Webloglines

Webloglines is a project offers a comprehensive collection of blogging services, articles, themes and plugins from around the world. Whether you're looking to promote your own blog or find blogs on various topics, this site is for you.


Search


Topics

  • Adsense (12)
  • Blogging Tips (73)
  • Blogs Slides (25)
  • Blogs Websites (22)
  • Digg (20)
  • How to Blog (129)
  • Search Engines (9)
  • SEO (135)
  • WordPress Plugins (269)
  • WordPress Security (75)
  • Wordpress Themes (99)
  • Wordpress Tips (162)

© 2006 www.webloglines.com. All Rights Reserved. Powered by IRange