Wordpress SEO - What are you looking for?

If you're looking for answers to SEO or wordpress related questions, type in a phrase and wait for hints or click enter! The results also show links to external sources.

161 articles in the database

How to set a custom profile picture in WordPress?

[ Article content is protected by Plagiashield ]

avatar

If you are running pagesbased on WordPress then I'm sure you've had to deal with the comments users. This system contains Extensive options for managing discussions, co allows you to protect your site from spam and manage reader feedback. And if you need additional options, you can add them manually and use the appropriate plugs available on the repository WordPress. In addition, you can replace the standard commenting system with an alternative solution, such as Disqus, Facebook etc. But that's another tale...

In today's topic, we will display one of the most popular questions in beginners. We will be changing the default profile picture of users to our own, which will allow you to customize its appearance. Besides, changing the avatar will help to distinguish your website from the websites of your competitors, who use WordPress.

Therefore, to implement today's task, follow the 5 steps below:

1. create an appropriate avatar for the user

Creating your own avatar You should pay attention to its resolution. Depending on the chosen offspring theme, images with the resolution from 80×80 to 250×250 can be used on the page. With this, it does not make sense to create an image with a higher resolution. And although it will be adjusted to the necessary sizeof the motive, but it will increase the size websites i beforeIt also makes it longer to load. Also, it should be mentioned that WordPress reads popular graphic formats: gif, png, jpg. So an avatar can be created in one of these formats.

2. upload the image to your WordPress site

On the website can be upload a picture in several ways:

  • Use FTP and the file manager on hosting and upload the avatar directly to the server. At the same time, the user can choose any folder for placing the picture
  • Upload an avatar to the library media w panel WordPress administration. In this case address image will be set automatically via system.

We will use the 2nd way and add the avatar directly in the admin panel of the site. Therefore, we will go to Media => Add New.

Uploading an avatar to the media library

Once the avatar is uploaded, the image will turn out in a folder: /wp-content/upload/.

3. adding the code to functions.php

After adding an image, we need to "show" the system that we want to use our own avatar. Therefore, we need to insert a piece of code into the file functions.php of the default theme. At the same time we recommend to make all modifications of this file for the descendant theme, so that when the next update is made, they do not die. In our case it is not relevant. Therefore we will edit the file functions.php the default theme. You can also open the theme feature file in several ways. You can open it via FTP or use the editor built into the dashboard WordPress. The last way will be easier for beginners, so we will use it.

Go to Appearance => Editor and from among the files to edit choose functions.php. At the very end, we add the following code:

add_filter( 'avatar_defaults', 'setnew_gravatar' );
 
function setnew_gravatar($avatar_defaults) {
	$myavatar = 'http://adres-strony/wp-content/uploads'/your-avatar';
	$avatar_defaults[$myavatar] = 'New avatar';
	return $avatar_defaults;
}

Modification of functions.php file

Address URL attached picture

Note that the variable $myavatar should include the exact URL to the image on your server. You can recognise it in the media library (Media => Library) at the detailed preview of the added image.

4. changing the default profile picture

After entering the code, we need to make changes to the discussion settings and select our avatar as the default. Therefore, go to Settings => Discussion and select our avatar in the Default Profile Picture field.

Settings for the default profile picture

5 Checking the results

If everything was done correctly, an avatar uploaded by us must appear next to user comments.

User comment with new avatar

In case the image didn't work, pay attention to the function get_avatarwhich is responsible for displaying the profile picture. If this function contains the variable $default, remove it. Finally, the function get_avatar should look similar (depends on the theme):

You can find the above function in the file comments.php and functions.php. Although depending on the theme it may turn out to be in a different file templates.

Summary

In today's article we have shown you a simple way to manually change the standard profile picture in the commenting system to your own. This way you can set up an avatar that best suits your website design. While doing so, you can also choose an image, like and animation. Everything depends on your needs.

Avatar

O Janusz Kaminski

Company marketing specialist TemplateMonster. He has been working in the IT industry for 5 years. He has experience in SEO, internet marketing. Apart from that he is interested in web designing.
  • Internal Links and Sematics

  • Link building
  • Sematics
  • Link building has never been easier. Hundreds of link possibilities in one click.
  • See

[ Article content is protected by Plagiashield ]

SEMRush - the best tool for SEO and PPC.

en_USEnglish
Read previous post:
wordpress-https-ssl
Free SSL certificate. Why is it needed and how to get it?

Until a few years ago, only popular websites and large companies with websites.... used the encrypted version of the http protocol

Close