Custom Avatar Shortcode
-
I’m using the following shortcode to pull in user avatars for a front-end dashboard in conjunction with ‘WP User Avatar’, which allows users to set their own avatar. I’ve set a new avatar for myself, yet I’m still seeing the default Mystery Man.
I wanted to know if anyone could perhaps spot any issues/conflicts that would stop the custom avatar being displayed? I’m completely stumped, so would massively appreciate some opinions.
// User Avatar add_shortcode( 'current-avatar' , 'ss_get_current_avatar' ); function ss_get_current_avatar(){ $user = wp_get_current_user(); echo get_avatar( $id_or_email, $size, $default, $alt ); } // Add class to avatar add_filter('get_avatar','add_gravatar_class'); function add_gravatar_class($class) { $class = str_replace("class='avatar", "class='avatar welcome_avatar", $class); return $class; }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Custom Avatar Shortcode’ is closed to new replies.