You may remember that I recently wrote a tutorial on how to create your Gravatar image for WordPress. Some of you asked me how I was able to create the default Gravatar in my comments:
Isn’t in nicer to have a default image that matches your blog design, rather than that generic one on the left? I agree. I’m going to walk you through this so you can do this for your own site. (Note: this is for self-hosted WordPress sites. If you’re on the free WordPress.com platform, you will not have access to the files necessary to accomplish this!).
First, you will need an image. I recommend an image that is 48 x 48 pixels (this is the default Gravatar size). Unless the image has a transparent background, I save the file as a JPG, as PNG files tend to take longer to load in browsers. However you choose to save it, name it ‘gravatar’ so WordPress can pull it correctly.
Then, you will need to access your FTP or your File Manager in your web-hosting account.
Find the images folder under wp-contents, themes, (your theme name), images. If you do not have an images folder in your theme (rare), you can create one. Upload your custom gravatar in to the image folder, which should be named gravatar.jpg*.
Be very careful with this next step, as one extra semi-colon could break your site! Be ye warned! Save a copy of your functions file before attempting this.
Finally, copy and paste the following code (click on ‘view raw’) into your functions.php file of your theme. Omit the first two lines.
Did you save a copy of your functions.php file before hitting save? I’m serious!
Now, when you go to your Settings > Discussions, you should scroll all the way down and see a new option at the bottom of the list of Gravatars.
Select your brand new custom gravatar and hit Save. Now, anytime someone without a Gravatar comments on your blog, instead of there being a default grey humanoid, they will have the pretty custom Gravatar you have assigned for your theme.
Have any questions? Ask in the comments section (and admire your Gravatar).
*Feel free to change the name of your Custom Gravatar. Just be sure that its name is reflected in the PHP coding.
GoDaddy Managed WordPress is built from the ground up for maximum performance, security and ease of use. Click here to experience the difference.
tasha says
Do you paste the code you supplied anywhere in the function.php file? or at the very end? Thanks
Lisette says
Tasha, I would paste it at the very end! This way we avoid your site going down if we accidentally place it in the middle of another function.
Melmanka says
Hi
thanks for the article. I have a stupid question about the name of the image. Should it be:
gravatar.jpg* OR
gravatar.jpg OR
gravatar (saved in .jpg format) ???
Thanks in advance for clarification
Janice - Salads for Lunch says
Great tutorial, I got it to work!! Thank you so much!