Hey there, fellow WordPress enthusiast! 🌟 Have you ever wanted to add a personalized touch to your WordPress author profile? You can upload an avatar without any plugin or Gravatar, but what if you could go beyond that and showcase a unique custom image that truly reflects your style and personality? Well, you’re in luck! In this guide, we’re going to walk you through the process of adding a custom author image to your WordPress user profile without fumbling around with plugins.
Step 1: Get Your Custom Image Ready
Before we get our hands dirty with the code, let’s start with the basics. You need a custom author image that’s all spruced up and ready to rock. Think of it as your author signature – a small square or round image around 200×200 pixels is usually a good bet. Make sure it’s looking spiffy and suits your unique vibe!
Step 2: Access Your Theme Files
To begin, log in to your WordPress dashboard and navigate to the “Appearance” section. From there, select “Theme Editor.” Alternatively, you can use an FTP client or the File Manager provided by your web hosting provider to access your theme’s files.
Step 3: Edit the functions.php File
Within your active theme directory, you’ll find a file named functions.php. This file is the heart of your theme, containing custom functions and code that enhance its functionality. It’s crucial to approach this step with caution, as any incorrect modifications can affect the entire theme.
Open the functions.php file for editing and add the following code at the end:
add_filter( 'avatar_defaults', 'wpb_new_gravatar' );
function wpb_new_gravatar ($avatar_defaults) {
$myavatar = 'your_image_url';
$avatar_defaults[$myavatar] = "Default Gravatar";
return $avatar_defaults;
}
Step 4: Save and Update Files
Once you’ve added the code to the functions.php file, make sure to save the changes. It’s a good practice to keep a backup of the original functions.php file in case you need to revert the changes.
Step 5: Add the Custom Author Image URL
Now that the code is in place, it’s time to test it out. Log in to your WordPress dashboard and navigate to “Users” > “Your Profile.” You’ll notice a new section labeled “Custom Author Image.” In this section, you can input the URL of your prepared custom author image.
Step 6: Update Your Author Profile
After adding the custom image URL, don’t forget to click the “Update Profile” button to save your changes.
Step 7: View the Custom Author Image Profile
With the custom image URL saved, you can now see the changes in action. Your custom author image will be displayed in your WordPress user profile, as well as in the author box when visitors view posts authored by you.
1 Comment
but what if we want to put seperate image for seperate author ?