Show image if author meta (profile fields) exists outside loop

get_the_author_meta accepts two parameters

  • $field – Field name for the data item to be returned.
  • $userID – If a user ID is passed to the function, it will return data for the specified user ID.

So just pass the user ID or author ID eg:

 if (get_the_author_meta('aim',$author_id)) { ...