I have a top commentator widget in my footer and some people have been asking how I managed to change the default WordPress comment avatar into an image tailored to fit into my theme. The current avatar options are fine, but do you really want something that looks like what everybody else is using on WordPress? Of course not. So how did I get my custom avatar image to show up in my WordPress dashboard as a new option under Settings -> Discussions like this?
Here’s how: Just make your own avatar (size should be 80px by 80px), upload it on the images folder of your current theme and insert the below code in your functions.php:
// Add Custom Gravatar add_filter( 'avatar_defaults', 'newgravatar' ); function newgravatar ($avatar_defaults) { $myavatar = get_stylesheet_directory_uri() . '/images/newgravatar.png'; $avatar_defaults[$myavatar] = "CustomGravatar"; return $avatar_defaults; }
Make sure to change ‘/images/newgravatar.png’ to the name of the avatar you uploaded to your images folder. Your custom avatar should now appear in your WordPress dashboard as a new option under Settings -> Discussions. Make sure to select the custom avatar you just made and save the changes. That’s it!
7 Responses
I want to have a custom avatar pero di ako marunong gumawa:( I mean yung design etc.. ehehe
gusto ko man i-try, saka na lang pag gagawa ulit ako ng isa pang blog. I have wordpress pero wala maxadong time para ma familiarize sa settings and all, na try ko once pero nahirapan ng bungga ‘te. next time, at least alam ko na gagawin sa avatar. ^^,
thanks for the tip! ive always wondered how this works!
ay eto pala un. matry ko nga ito.
ay di ko pala sya magagawa sa redismarose.com kasi na kay sam ata un template nun. sayang.
pwde ko rin ba yan gawin sa free templates na nakuha ko sa web sa ibang blog ko?
Namimiss ko ang 2008, kasi hindi ako hirap mag sulat nuon, kung ano na lang ma isip ko, type agad kahit alam kong walang sense, at least nakakatapos ako ng isang blog post.