0

I'm calling an avatar in a theme with get_currentuserinfo. The avatar appears at 96x96 pixel width & height. Changing that size is not problem.

I made a custom function & shortcode to use it in the theme:

  function get_loggedin_avatar (){
    global $current_user;
    $result = '';

    if ( is_user_logged_in() ) {
        get_currentuserinfo();  
        $result = '<a href="/myaccount">'.
            get_avatar( $current_user->ID, 96, left ).
            '</a>';
    }
    return $result;
}

    add_shortcode( 'loggedinavatar', 'get_loggedin_avatar' );

However, whenever I edit the thumbnail image settings a specific way, the avatar is affected. I make set the thumbnail to have a width of 0 and a height of 150, the avatar ouput changes to 96x54. Why is that and how can I edit the thumbnail size without affecting the avatar output?

  • I am not sure what you mean, since that's pretty internal function that doesn't return anything. Could you maybe provide a short code example? – Rarst Aug 24 '15 at 19:31
  • Doh - good suggestion, I just updated my question. – Arp Laszlo Aug 25 '15 at 16:21
1

Here is the code how i call the avatar on my posts:

 <?php  echo get_avatar( $post->post_author, $size = '150'); ?>

You can also define a default avatar if user has no avatar.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.