Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created October 30, 2011 00:21
Show Gist options
  • Save billerickson/1325292 to your computer and use it in GitHub Desktop.
Save billerickson/1325292 to your computer and use it in GitHub Desktop.
Avatar on Teasers
<?php
/**
* Avatar on Teasers
*
* @link http://www.billerickson.net/using-gravatars-in-wordpress/
* @author Bill Erickson
*
*/
function custom_author_post_avatar_teaser(){
if( is_home() ){
if( get_query_var( 'author_name' ) ){
$curauth = get_userdatabylogin( get_query_var( 'author_name' ) );
}else{
$curauth = get_userdata( get_query_var( 'author' ) );
}
?>
<div style="float:left;padding-right:10px;padding-bottom:10px;">
<? echo "<a href=\"".get_bloginfo('url')."/author/".get_the_author_meta( 'user_login' )."\">".get_avatar( get_the_author_email(), '50' )."</a>"; ?>
</div>
<?
}
}
add_action('thesis_hook_before_teaser', 'custom_author_post_avatar_teaser');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment