Lifehack logo

How To Customize The Default Wordpress Avatar Without Plugins Or Crap

You may have noticed that there are blogs, like mine, that have a different avatar.

By ASHFAQ ALIPublished 2 years ago 3 min read
Like

You already know that in WordPress, when you comment, sign up for a blog, forum, etc… it takes a photo of you by default, which is the one you configured in your Gravatar account .

But of course, there are many people who do not have a gravatar account, and when they comment, the photo of the mysterious man appears. That is the default WordPress avatar, and you can customize it by choosing from several, from Settings/Comments.

But you may have noticed that there are blogs, like mine, that have a different avatar.

And today I'm going to tell you how to get it for your own Blog.

I Present Two Methods To Customize The Default Wordpress Avatar

The two techniques that I am going to present to you are valid for any blog with WordPress.org, regardless of the theme.

It's nothing specific to the Genesis Framework .

Technique #1. Install The “Wp User Avatar” Plugin

Ready. If you are one of those who likes to solve everything in a simple way, and accumulate plugins, here is one that will help you customize the default WordPress avatar.

But in the title it promised to do it without plugins.

If you are one of the brave, keep reading until the end.

With WP User Avatar , you can do it very easily.

1. Install the plugin from Plugins/add new plugin.

2. Activate it.

3. From Settings / Comments, customize your Avatar.

It has a lot more features, and there is even a Pro version.

But personally, it's not a plugin I would use.

That is why I better tell you the following technique.

Technique #2. Add 7 Lines Of Code To Your Functions.Php File

Yes, only 7 lines.

With that you have already replaced a plugin and lightened the load of your blog .

Well, you also have to upload the image, that's clear. But what a mess, I better tell you the steps:

Access your functions.php file

• By FTP, it will be in wp-content/themes/tutema

• By Appearance / Editor, if you have it active, look for the Theme Functions file (functions.php)

Add at the end of all these lines:

//* Display to custom Gravatar

add_filter( 'avatar_defaults', 'sp_gravatar' );

function sp_gravatar ($avatar) {

$custom_avatar = get_stylesheet_directory_uri() . '/images/custom-gravatar.png';

$avatar[$custom_avatar] = "Custom Gravatar";

return $avatar;

}

And now prepare your custom image. On canva.com , or in Photoshop, or your favorite image retouching program, prepare an image that is at least 120x120px.

Create your custom avatar for WordPress, however you want.

When you're done, save it as “custom-gravatar.png”.

And upload it via FTP or via the file manager of your hosting control panel, to “/wp-content/themes/tutema/images/”

If you don't know how to upload it via FTP, upload it to WordPress, like any other image, and copy the full image url.

Now in the code, replace "/images/custom-gravatar.png" with the path of the image you uploaded.

Respect every quote, every semicolon, and every symbol, or the code will fail and your website won't load. If that happens to you, just look closely and fix the code, or delete what you've done. That's why it's a good idea to access via FTP. It is much better.

Well, now you can go to “Appearance / Comments” and select your new default avatar.

Are You Encouraging To Customize Yours?

As you can see it is simple, and with the plugin even more so.

I am one of those who avoid plugins, and if you access via FTP, nothing bad will happen. If you miss a single comma, you will see your website blank.

But you look closely, you fix it and that's it. And you just saved a plugin and get to know better how your website works.

What icon do you consider putting as a custom WordPress Avatar?

social media
Like

About the Creator

Reader insights

Be the first to share your insights about this piece.

How does it work?

Add your insights

Comments

There are no comments for this story

Be the first to respond and start the conversation.

Sign in to comment

    Find us on social media

    Miscellaneous links

    • Explore
    • Contact
    • Privacy Policy
    • Terms of Use
    • Support

    © 2024 Creatd, Inc. All Rights Reserved.