• Hello,

    I need to add a bootstrap image class to the member’s avatar in the directory, is there a way to do this?

    If not, how do I retrieve the member’s avatar URL? (Note I need the member’s avatar URL and not the logged-in user’s)

    Thank you

Viewing 1 replies (of 1 total)
  • Plugin Support Aswin Giri

    (@aswingiri)

    Hello @smae

    Please try the following code snippet to add a custom class to the avatar image.

    add_filter( 'get_avatar', function( $avatar, $id_or_email, $size, $default, $alt, $args  ){
        return str_replace( 'class="','class="my-custom-class ',$avatar );
    },999999,6);

    Please remember to replace my-custom-class with the class you want to add and the class name needs a space after the class name like in the code snippet.

    This will add class to all of the avatars.

Viewing 1 replies (of 1 total)
  • The topic ‘Add Avatar Class’ is closed to new replies.