Tutorials WordPress How to Change Default WordPress Avatar

How to Change Default WordPress Avatar

Gravatar is a globally recognized avatar service, being used in most of the WordPress blog today. If you are using gravatar service you just need to register and map your personalized image avatar to your email id once. Gravatar identifies your post and automatically, your avatar will appear on the blog.

Gravatar is built into WordPress and it is used in the author bio section. If a user email address is not registered with Gravatar, WordPress allows you to pick some of the boring default images to show as the default avatar. Sometimes, “Mystery Person” looks quite boring on a fancy looking website.

In this example, we will take a look into how to customize the avatar and add a default image of your choice.

Step-1 Upload New Gravatar Image

Upload the image that you want to show as your avatar to themes image folder. The theme folder can be found in the following path. Here in this example my file name is default-avatar.png and uploaded to the following location.

wp-content/themes/twentyeleven/images/default-avatar.png

Step-2 Adding WordPress Hook

Once you have uploaded your image in the above step, you need to write the below code that works as WordPress hook to add a new default avatar image. Paste the below code in your functions.php file located in your themes folder.

/** Add a new default avatar **/
add_filter( 'avatar_defaults', 'add_gravatar' );

function add_gravatar ($avatar_defaults) {
       $myavatar = get_bloginfo('template_directory') . '/images/default-avatar.png';
       $avatar_defaults[$myavatar] = "MY Gravatar";
       return $avatar_defaults;
}

Step-3 Change Default Avatar Settings

Now you are almost done. Just visit Settings -> Discussions -> Default Avatar section in your WordPress admin dashboard, and you will find your newly added avatar image listed as shown in the image below.

Change Gravatar Image WordPress

That’s all. Now you will see your newly created avatar in author bio and other section as per your theme layout.

Total
0
Shares
guest
0 Comments
Inline Feedbacks
View all comments
Previous Post
Eclipse Tutorials and Plugins

Architexa UML Modeling Tool Suite for Eclipse

Next Post
Agile tools

Unleashing Agile Development Tools Amended For Better Performance

Related Posts
By clicking “Allow All”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. Cookie Notice
Allow All
0
Would love your thoughts, please comment.x
()
x