Gravatar is used globally. It shows your image beside your name when doing things like comments, post on a blog site. Gravatar supports in popular applications like WordPress as well as others too. So its necessary to change gravatar image size in WordPress sometimes.
Most of the WordPress Themes show gravatar images left side of the comment section. If your Theme doesnt have this one, then you can use WordPress plugin to show your gravatar image such as you can use WP Author Bio Plugin for that.
Lets drive on how to change gravatar image size in your WordPress site.
First of all what you need to do is to find comments.php in your Themes. So youll need to use FTP or File Manager to do that because these tools will allow you to access your file.
This file can be found in your Theme directory ( wp-content/themes/your-activated-theme ) .
If you get the file then open it in a code editor or you can use notepad. And try to find a function called wp_list_comments function, it takes an array as a parameter. Given an example bellow.
wp_list_comments( array( 'avatar_size' = 50, 'max_depth' = 5, 'style'. = 'ol', 'short_ping'. = true, 'type'. = 'comment', ) );
As you can see there is a key of that array called avatar_size so what you can do simply change the value as you want. Itll change gravatar image size. It sets both the width and height of your gravatar image. So if you change it then thatll be affected in front-end.
After saving your code check this out in front-end its working or not. If it works then youre good to go. Or youll need to check css code of your Theme.
Because your Themes css is overriding the size. So to check this out, Go to any blog post of your site and in comment section use inspect element tool of chrome if youre using chrome browser but if not you can use your default browser.
After that find out that any css code is overriding the default gravatar image size or not. As you see Ive given an example below. And my Themes css is not letting me change Gravatar Image size in my WordPress site.
Your Theme definitely has this kind of codes that preventing to change gravatar image size in your WordPress site as well.
So to change gravatar image size what you can do is overriding the css code. To do this youll need to open style.css of your Theme.
Youll find it in your Theme directory ( wp-content/themes/your-activated-theme/style.css )
So open it and past the code below.
.comment .avatar { width: 50px; height: 50px; }
Now it should work after saving your code. If you cant see the updates just clear your browser cache and reload your page or check this out in an incognito window.
Note: you can use your height and width as you want.
I will recommend not to use big image size. Because it will look like blurry.
Also, it can affect your page speed. So its better to use small size.
Thats all to change gravatar image size in your WordPress site.
How to change gravatar image size in the author bio.
Actually, it depends on the Theme youre using currently. Because they can use this different way.
Such as if youre using WordPress default Twenty Seventeen Theme, then you can change gravatar image size with a filter hook.
Here is how :
function webextent_change_author_bio_image( $default_size ) { $default_size = 50; return $default_size; } add_filter('twentysixteen_author_bio_avatar_size', 'webextent_change_author_bio_image');
Paste the code in your Themes functions.php and save. You can set your value as you want.
Note : Other Themes may use this get_avatar( get_the_author_meta( ‘user_email’ ), 32);
So youll need to find out the code and file and simply change the value.
I hope that you like this article. If you would like to know about WordPress security then you can check this out here : 10 important tips for WordPress security
Tags: change gravatar image size create gravatar wordpress gravatar profile in wordpress wordpress profile images wordpress profile photo WordPress tips
0 comments