![]() |
|
||||||
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Recently, I wanted to make the Author page (author.php) a little more robust by replacing the static image with Wordpress Gravatars (Global avatars - http://www.gravatar.com - which are assigned to your Wordpress email address). This gives individual authors the ability to change their pictures independently without uploading any files to the server.
I also added a few conditional tags to display contact information if provided in the "Your Profile" section of Wordpress. If an author enters their website, email address, or Twitter ID, it will automatically be displayed on their profile. I have hijacked the "Yahoo Instant Messenger" field in the profile section for entering your Twitter username so keep that in mind. Please note that these changes require Wordpress 2.8 because I used the new author meta template: http://codex.wordpress.org/Template_Tag ... uthor_meta This code starts at approximately line 7 in author.php. Code:
<div class="postarea">
<?php $recent = new WP_Query("showposts=1"); while($recent->have_posts()) : $recent->the_post();?>
<?php $curauth = (get_query_var('author_name')) ? get_userdatabylogin(get_query_var('author_name')) : get_userdata(intval(get_query_var('author'))); ?>
<h5><?php echo $curauth->display_name; ?></h5>
<div class="author" id="authorinfo">
<?php if (function_exists('get_avatar')) { echo get_avatar(get_the_author_meta('user_email', $curauth->ID), '80'); }?>
<?php echo $curauth->description; ?></p>
<?php if (get_the_author_meta('yim', $curauth->ID)) { ?>
Twitter
<?php } ?>
<?php if (get_the_author_meta('user_url', $curauth->ID)) { ?>
| Web
<?php } ?>
<?php if (get_the_author_meta('user_email', $curauth->ID)) { ?>
| Email</p>
<?php } ?>
</div>
<div style="clear:both;"></div>
Code:
#authorinfo img {
margin:0px 10px 13px 0px;
padding:2px;
float:left;
border:1px solid #C0C0C0;
}
__________________
Evan Wondrasek |
|
#2
|
||||
|
||||
|
nice share!
__________________
StudioPress on Facebook Copyblogger | StudioPress | ScribeSEO Teaching Sells | Third Tribe | Premise Follow me on Twitter |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Gravatars? | Robert Palmer | General Discussion | 4 | 03-23-2010 07:16 PM |
| Using author photos that are not gravatars | jnor | General Discussion | 2 | 01-07-2010 12:11 AM |
| Blog Post Author Gravatars | lfaber | General Discussion | 9 | 08-15-2009 08:35 AM |
| Gravatars | dugeasy | General Discussion | 1 | 02-18-2009 10:03 PM |
© Copyright 2012 Copyblogger Media LLC · StudioPress™ is a trademark of Copyblogger Media LLC
Privacy Policy | Refund Policy | Terms of Service | Affiliate Program | Contact Us