Add the Post Author Avatar

From IThemes Codex
(Difference between revisions)
Jump to: navigation, search
(Created page with "If you want to show the post author avatar on a page, add the following code at the end of your functions.php file (but before the closing <code>?></code>, if any). ====Code=...")
 
 
Line 1: Line 1:
 +
__NOTOC__
 +
 
If you want to show the post author avatar on a page, add the following code at the end of your functions.php file (but before the closing <code>?></code>, if any).
 
If you want to show the post author avatar on a page, add the following code at the end of your functions.php file (but before the closing <code>?></code>, if any).
  

Latest revision as of 15:44, July 22, 2013


If you want to show the post author avatar on a page, add the following code at the end of your functions.php file (but before the closing ?>, if any).

Code

function my_insert_avatar() {
    global $post;
    return get_avatar($post->post_author, 64 );
}
add_shortcode('insert-author-avatar', 'my_insert_avatar');

Usage

Insert the shortcode [insert-author-avatar] in your LoopBuddy layout where you want the Avatar to appear.

Customize the Appearance

In this example, the avatar is displayed as a 64px by 64px image. Change this value if you want the avatar in another format.

Additional documentation

get_avatar function reference from WordPress Codex


← Back to LoopBuddy Codex Home

Personal tools
Namespaces
Variants
Actions
iThemes Codex
Codex Navigation
Toolbox