Profile Picture/Avatar Shortcode
-
This isn’t a support question, it took me a while to figure out how to get a shortcode profile pictures. Hopefully this will help someone.
Download the Avatar Manager Plugin (https://wordpress.org/plugins/avatar-manager/)
Input this code into your functions file or use the my custom functions plugin (https://tt.wordpress.org/plugins/my-custom-functions/)
function logged_in_user_avatar_shortcode() {
if ( is_user_logged_in() ) {
global $current_user;
get_currentuserinfo();
return get_avatar( $current_user->ID );
}
}
add_shortcode(‘logged-in-user-avatar’, ‘logged_in_user_avatar_shortcode’);That’s it. Use the shortcode [logged-in-user-avatar] and the um profile picture will appear on post/pages.
The topic ‘Profile Picture/Avatar Shortcode’ is closed to new replies.