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.