Instead of outputting
<img alt="" src="#" srcset="#" class="avatar avatar-60 photo" height="60" width="60">
I want to add custom class which looks like
<img alt="" src="#" srcset="#" class="avatar avatar-60 photo myclass" height="60" width="60">
To achieve this, I tried to use
get_avatar( $comment, $args['avatar_size'], '', '', array('class' => 'myclass') );
However it doesn't change anything. Any help guys?
Instead of outputting
<img alt="" src="#" srcset="#" class="avatar avatar-60 photo" height="60" width="60">
I want to add custom class which looks like
<img alt="" src="#" srcset="#" class="avatar avatar-60 photo myclass" height="60" width="60">
To achieve this, I tried to use
get_avatar( $comment, $args['avatar_size'], '', '', array('class' => 'myclass') );
However it doesn't change anything. Any help guys?
Share Improve this question asked Nov 6, 2018 at 21:47 p onelandp oneland 171 silver badge8 bronze badges 1 |1 Answer
Reset to default 0The following worked for me:
<?php echo get_avatar( $comment, 60, '', '', $args = array( 'scheme' => 'https', 'class' => 'myclass' ) ); ?>
Your use of $args['avatar_size']
should be an int and you may have confused the use of this parameter (unless you have a variable $args, and it is an array).
get_avatar
filter is being run somewhere within the active theme or a plugin. This would modify the output of your call toget_avatar()
. Try searching within the files forget_avatar
. – Dave Romsey Commented Nov 6, 2018 at 22:51