Skip to content

Instantly share code, notes, and snippets.

@hannit
Created December 22, 2016 10:40
Show Gist options
  • Save hannit/add30faf33125c748fea8279ff3e489a to your computer and use it in GitHub Desktop.
Save hannit/add30faf33125c748fea8279ff3e489a to your computer and use it in GitHub Desktop.
function get_user_image($user) {
$img = get_field('author_image', 'user_'.$user->id);
if (!empty($img)) {
$img = wp_get_attachment_image($img['ID'], 'user_avatar');
} else {
$img = get_avatar( $user->ID, 130);
}
return $img;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment