How To Create And Add Custom Default Avatar In WordPress – Gravatar
Commenting system in wordpress is a great way to converse
with other users and when the commenter has an image the conversation becomes
more interesting. All wordpress blogs uses Gravatar for comments to display
avatar for each user. Each avatar is generated based on their email address
that they used in Gravatar.com. Using Gravatar is one way to show your identity
across the World Wide Web. Learn more about what, why and how to use
Gravatar in WordPress. Here we will see how to create and add custom default
avatar in wordpress.
There are many still don’t have a pic at Gravatar. A
commenter without an image at Gravatar simply ends up seeing mystery man
instead of his/her face. If you are running a wordpress blog then you can see
too many mystery faces in comments area. If are you bored with the mystery man
then change the default Gravatar in wordpress and add your own custom default
avatar. Here in simple easy steps we will show you how to create and add custom
default avatar in wordpress.
Use Of Adding A Custom Avatar
Before changing the default Gravatar in wordpress let’s see
the use of creating and adding custom avatar. In your wordpress dashboard go to settings
>> Discussions and at the bottom you can see 7 default avatar.
If a user makes a comment without his/her image then
wordpress simply displays these custom avatars. This is something other
commenters don’t like to see as well as they can’t identify his/ her face. So
instead of these custom avatars you can just add your site logo for branding
just like the Gravatar logo.
Another reason is, all these custom avatar is not hosted in
your server. All these image calls from remote Gravatar servers. This is not
going to slow down your site, but the images hosted in your server loads
quickly than the image hosted in remote server.
Moreover all these default custom avatar gets bored after
seeing in many websites, especially the Mystery man. So are you ready to change
the default Gravatar in wordpress.
How To Create A Custom Default Avatar In WordPress?
We will provide you a code (no worries we will guide you)
that adds one more avatar to list the of 7 default avatars. Before adding the
code you must create a custom avatar for yourself. Use your site logo or if you
have more designing skills then create a nice image and save it as custom-avatar.png.
Also you can get free to use icon sets available for download in many sites.
Have the image dimensions equal like 35 X 35, 60 X 60, 70 X 70 etc. You have
created your custom avatar, now we need to add it in your wordpress site.
How To Add Custom Default Avatar In WordPress?
To add custom default avatar in wordpress just copy the code
below. Now go to your wordpress dashboard appearance >> Editor and
then select Theme Functions (functions.php). Then add the code at the
bottom of functions.php file. If you see the closing tag ?> then
just add the code before that tag or else simply add it below.
//**Custom Gravatar**// add_filter( 'avatar_defaults', 'new_default_avatar' ); function new_default_avatar ( $avatar_defaults ) { $new_avatar_url = get_bloginfo( 'template_directory' ) . '/images/new_avatar_image.png'; $avatar_defaults[$new_avatar_url] = 'avatar_name_here'; return $avatar_defaults; }
Some themes do not allow you to add code in functions.php.
If so then create a custom-functions.php file and add the above code
and upload it to your theme folder using FTP.
Now you need to call the image and to do so upload the custom-avatar.png image
in your theme folder.
That is in wp-content/themes/your-template-name/images/custom-avatar.png.
That is in wp-content/themes/your-template-name/images/custom-avatar.png.
After this process go to discussion settings in your
wordpress dashboard. At the bottom you can see your custom avatar that is added
in that default list. Select that and save changes, now your site displays
custom default Gravatar for users who don’t have a custom avatar.
Plugins To Change Default Gravatar In WordPress
Other than adding codes there are two plugins in which you
can change your default Gravatar. Add New Default Avatar plugin adds
a new default avatar in your wordpress discussion settings. You can choose the
image URL and display your own custom Gravatar. Another plugin is wp useravatar is which you will have the option to display your own custom avatar
even though if the user has an image in Gravatar.
I can hope this article provided you a detailed note on how to create
and add custom default avatar in wordpress. As well as changing the default
Gravatar in wordpress made simpler with those two plugins. Share it and leave
your comments.
No comments:
Post a Comment