Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Swapping Author Box Gravatars for Locally hosted Images

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #204815
    lvvvvvl
    Participant

    I’m trying to increase my website speed by removing useless connections to external servers. I use disqus but my author box uses gravatar to display the authors image.

    I’ve tried writing up a code that would simply replace the functionality of get_avatar but it’s creating some sort of error in my admin panel in which it loads the left side menu but all the content of the admin pages simply displays the blank background.

    This is the code which I’m using and pasting the author avatar image url in their ‘yim’ profile section:

    //* Local Author Gravatars *// 
    add_filter('get_avatar', 'get_no_gravatar', 1, 2);
    function get_no_gravatar( $id_or_email, $size = '180', $default = '', $alt = false ) {
       // put your new function in here
            $avatar = '<img alt="'.get_the_author_meta('display_name').' Avatar" src="'.get_the_author_meta('yim').'" class="avatar avatar-{$size} photo avatar-default" height="{$size}" width="{$size}" />';
        return apply_filters('get_avatar', $avatar, $id_or_email, $size, $default, $alt);
    };
    

    Any suggestions of where I’ve gone wrong?

Viewing 1 post (of 1 total)
  • The forum ‘Back End’ is closed to new topics and replies.