Add the Post Author Avatar

From IThemes Codex
Jump to: navigation, search


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