How to Change the Gravatar Image Size in WordPress

In this article I’ll quickly walk you through how you can change the gravatar image size in your WordPress theme. Going to head over to my development site and scroll down, then here you see a couple of comments. This one doesn’t have a gravatar assigned to it but this one this is pulling in from and if you want to change the size of this and maybe make it bigger there are two areas that you want to look at changing.

This will require you to use your FTP client to connect to your host to make the changes on the files. I’m using a local development file. So I’ll show you what it looks like here. So I’m in my Wp-content section,

you want to go into your themes

and you want to change the theme that you’re working on.

We want to make changes to the comments file, we’ll open that up with a file editor.

And we’re looking for the comment list area like you see here.

The wp-list comments area and this is what’s driving the size. So you want to change that to whatever you want. Let’s try 96 and we’ll save it.

Now if I refresh and then if you hit refresh. And you don’t see anything then, then there’s another piece that is overriding it. You can tell that by right-clicking on there we’ll use our inspect element.

We find the image and you see that the height and width is still at 42 even though we changed that file.

So the second thing that you’ll need to change is the CSS.

So now I need to open my CSS file  we’re looking for the area of comment author avatar. You see that the height is 42 and the width is 42. So let’s change that to what we set the comment file for just 96 save that.

And now when you refresh you see that is much bigger.

Now you could just do the CSS but if you did that by itself and not changed the comments PHP page then this would actually be fuzzy and it wouldn’t look right. So that’s why you want to do both items together and that’s how you change the gravatar size for your WordPress theme.

Оставьте комментарий

Ваш адрес email не будет опубликован.