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).


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


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