How To Add Custom Avatar In WordPress Blog | Tutorial Freak – Online Tutorials

How To Add Custom Avatar In WordPress Blog

Avatars are the tiny images next to the author or commentator name in the comments section of your blog posts. Avatars are popular as they help in identification of the person who is commenting. We can also make them brandable. With services like gravatar it has become really easy to use avatars.

Now, if commentator doesn’t have an avatar, a default avatar must be loaded in the space. Many premium themes have a custom avatar to match colours with the theme. It is really good to brand your default avatar to make it look good. For example, we here @Tutorial Freak have set the default avatar as “TF” written in black with an orange background.

Now, let me teach you How to add custom avatars in your WordPress Blogs

  • Step: 1

    Before we start putting the avatar in wordpress you should first have a graphic ready which you want to show as default avatar. Image of 64*64 dimension is good.

  • Step: 2

    When you have the graphic ready, just upload it to the images directory of your theme. Lets say your avatar’s name is custom-avatar.jpg

  • Step: 3

    To add this avatar to the default gallery you will need to add the below function in the functions.php file.

    /**
    * add a default-gravatar to options
    */
    if ( !function_exists(‘fb_addgravatar’) ) {
    function fb_addgravatar( $avatar_defaults ) {
    $myavatar = get_bloginfo(‘template_directory’) . ‘/images/custom-avatar.jpg’;
    $avatar_defaults[$myavatar] = ‘Tutorial Freak’;
    return $avatar_defaults;
    }
    add_filter( ‘avatar_defaults’, ‘fb_addgravatar’ );
    }

    Add the above code in the end of functions.php file and update it.

  • Step: 4

    Now go to Settings —> and click on “Discussion”, you will be able to see the custom avatar you just added. You can now set it as your default avatar. See below:

    wordpress tricks

Hope this tutorial was helpful enough for you. Leave your feedbacks and suggestions in the comments column.

Author, Blogger, SEO Expert, Working Professional and a Student! I play so many roles in life and love what i do. I enjoy each moment of my life. Do follow us on Facebook

Sagar – who has written posts on Tutorial Freak – Online Tutorials.


Help keep us alive & kicking, we need coffee 24/7, please donate, thanks!
Embed

Leave a Reply

      
      
      
             
      
  • Xara Photo & Graphic Designer 2014..