WP First Letter Avatar - original WordPress user avatars. WordPress Avatars - Best Plugins Key Features of the Plugin

Most WordPress sites display avatars for custom images. These avatars can be images of the users themselves or can be customized by the owner of the website or WordPress. The default avatar is a silhouette resembling a person against a gray background. To be honest, it's boring. Luckily, we can easily change the default avatar for WordPress.

In this tutorial we will see how to do this. We'll also see how to choose your own avatar and how to use plugins to let your users choose their own avatars. It only requires basic knowledge - how to install the plugin, crop the image and upload the file, that's all.

What is an avatar?

WordPress defines an avatar as the image that appears next to your name when you comment on avatar-compatible sites. They are usually around 80×80 pixels in size and can be almost any file type, although the PNG format is popular.

How do I set my default avatar?

We've all seen the "mystery man" avatar. It's boring and reminds us that avatars are not customized for the site. Luckily, we are not limited to this default avatar. With WordPress we have several options.

You can choose a default avatar for everyone who comments on your site. There are several built-in options and you can even. These avatars are for commenters and users of your site ( if these people don't define a default avatar).

From the dashboard, go to Settings, Chat and select Avatars. Make sure the "Show Avatars" option is enabled. Here you have seven built-in options. You can also choose the appropriate rating for your audience (gx).

« Mysterious person This is the default value. Four of the options are generated. They use the presenter's name or email address to mathematically generate an image based on the model you choose.

The avatars on your site will be updated to match your default selection.

How to have your own avatar

You are not limited to the default avatars on the site, you can have your own avatar. The most popular is another Automattic company called Gravatar. Gravatar means "public avatar". You create your profile in one place, and it will follow you on every Gravatar-compatible website.

The benefit of having a Gravatar is that a person can have an avatar that follows them around the internet. How? They are associated with your email address. Every time you comment and use your email address, your default avatar will be used. If you don't have a default avatar, or if you don't have an avatar associated with your address, WordPress will assign a default avatar to your comment.

In the dashboard, go to Utilisateur"," Your profile And scroll down. You will see your profile photo. Change this image on Gravatar by clicking the link. You can also access Gravatar.com.

Some plugins for managing avatars

WordPress has many plugins for customizing and adding new avatars. Here's a quick overview of the most popular ones.

1 - Add a new default avatar

Add New Avatar by default adds a field where you can link images to use as an avatar. Add as many avatars as you want, and each one will appear in the list of options. You can even specify the image size. This plugin provides examples of how to specify a URL with an image size.

2 - WP First Letter Avatar

WP First Letter Avatar creates an avatar using the first letter of a user's name if those people don't have a Gravatar. Each letter has a different background color. Avatar includes several sizes and will automatically select the most suitable size. You can even create your own avatar game and use the same naming rules. You can also disable Gravatar if you want all users to have letter avatars.

3 - avatar manager

Avatar Manager allows your registered users to upload their avatars to your website. The download file is added to their settings page ( profile page). You can specify default pixel sizes and custom resolutions. Users can use their downloaded Gravatars or avatars.

4 - WP User Avatar

WP User Avatar adds file upload functionality to the avatar list and library where you can view and manage your uploaded avatars. All images in your library can be used as an avatar. You can add a loading shortcode to widgets and articles to allow members and followers to add their avatars. You can also set restrictions on their files and disable Gravatar if you want more control.

That's it for this list of plugins. Feel free to recommend this article to your friends on your favorite social networks.

(Last update: 12/01/2019)

Greetings, dear reader! How to add your own avatar image in WordPress? For those who don't already know: An avatar is an image next to your name that helps identify your comment on sites that support this feature. WordPress Avatars currently only allows the use of custom avatars uploaded by , but our helper plugins will extend this functionality and allow you to use any picture, image or photo uploaded to your media library.

Changing your avatar on a WordPress website

How to upload your avatar to WordPress? How to change the default avatar in WordPress? How to change user avatar shape in WordPress?

As you browse various websites, you may notice that many users have an image next to their name. These pictures are called avatars.

Today, friends, I want to introduce you best free avatar plugins for WordPress, with the help of which you will get various options and settings for displaying avatars for yourself (the author) and visitors who leave comments on the site to their liking. Something like that.

WP User Avatar plugin - avatars for WordPress

Currently, WordPress only allows you to use custom avatars uploaded via Gravatar. WP User Avatar allows you to use any photo uploaded to your library as an avatar. This means you are using the same load and library as your messages. No additional folders or image editing functions are required.

WP User Avatar plugin

This plugin allows you to use any photo or as an avatar for WP comments. The picture can be uploaded from your computer or used from your media library. And also, use a default avatar in the form of a black man with a big mustache, just like Chapaev:

Default avatar

The module has already been downloaded by more than 700,000 users, so the author constantly updates it. The WP User Avatar plugin is installed in the standard way, through a plugin search. Enter its name, install and activate it, and then go to the avatar settings:

Setting up the WP User Avatar plugin

If you check the third box - Disable Gravatar and use only local avatars, then you can use the default avatar, both for yourself and for commentators, or upload a new picture for the avatar. I hope everything is clear to you here.

Simple User Avatar-Simple user avatar

Simple user avatar

This plugin makes life easier for WordPress users. Simple Custom Avatar helps you add or remove your avatars using images from your media library.

An example of presenting a new option on a user page

How to Make WordPress Avatars Round, Heart, Diamond

This can be done using a simple plugin called Avatar Shaper.

The Avatar Shaper plugin allows you to customize the style of user photos/avatars

Avatar Shaper plugin

With Avatar Shaper you can easily customize the style of your avatar, that is, make it round, round the corners of a square avatar and much, much more. You can also add a shadow to the picture/avatar, or a glow to the photo by choosing the desired color. The plugin does not load your blog, it only adds CSS styles to your site. After installing and activating the module, go to Settings - Avatar Shaper and select the desired style:

WordPress Avatar Style Settings

Here, please select and configure the desired style for your avatar image in the site comments. On the right side of the page, there will be a preview of the avatar.

Hello my readers! Today I will talk about Gravatar in WordPress:

  • what is gravatar;
  • how to enable gravatar for comments in WordPress;
  • how to add a new default gravatar for blog readers;
  • FV Gravatar Cache plugin - speed up loading of reader avatars.

What is Gravatar

Gravatar is a service located at gravatar.com, which allows you to attach a universal avatar to your email address. This avatar will be stored on this service and displayed next to your comments on sites and blogs that support the Gravatar function. Of course, when commenting, you should indicate the email to which you linked your gravatar.

What benefits does this give us? By changing your avatar on just one service, you change it for all your comments on different blogs. This method may not be flexible, but it saves a lot of time. In addition, on most blogs registration is prohibited and you do not have such a profile, but for this avatar you only need to indicate your email.

I already discussed it on my blog earlier in a separate article, because the gravatar function is available not only for WordPress, but also for other modern CMSs. Only Drupal and Joomla require additional plugins to be installed.

Enable gravatar in WordPress and create a new default avatar

WordPress versions 2.5 and above have gravatar built in by default. There is no need to add any additional code to the templates of the theme used - everything is configured through the WordPress admin panel.

Go to the “Options” - “Discussion” section and scroll down the page to the “Avatars” item.

The first thing you should do is enable the display of avatars:

and a default avatar that will be displayed to users who do not have an account on gravatar.com:

The choice is small, but you can add your own picture. Let's look at how to do this.

Method No. 1.

Find a new image and upload it to the server in the folder with images of the WordPress theme you are using: wp-content/themes/theme_name/images. Next, open the functions.php file for editing and add it on the following lines after:

this block of code:

add_filter( "avatar_defaults" , "newgravatar" ) ; function newgravatar ($avatar_defaults) ( $myavatar = get_bloginfo("template_directory" ) . "path to picture"; $avatar_defaults [ $myavatar ] = "NazvanieAvatara" ; return $avatar_defaults ; )

Don't forget to enter path to the picture(/topic_name/imades/picture_name) and NazvanieAvatara , under which the image will be listed in the default avatar list.

We save the changes in the functions.php file and go to the “Options” - “Discussion” section of the WP admin panel, where we select the newly added image from the list of available avatars.

Method number 2.

You can use the plugin - Add New Default Avatar. The plugin is installed as standard; after activation, its settings will appear in the “Appearance” section - “Add New Default Avatar”.

All you have to do is select a picture from your computer (Upload Image), set its name (Avatar Name) and click Add Avatar. The plugin will upload the image to the server itself, all you have to do is select it.

FV Gravatar Cache plugin

The last thing I want to talk about in this article is a small plugin called FV Gravatar Cache, which allows you to cache gravatars in WordPress, thereby increasing the loading speed of blog pages with a large number of comments.

Download FV Gravatar Cache from wordpress.org, unpack the archive into the current directory and upload the resulting folder to the server in the wp-content/plugins directory using . Activate the plugin through the WP admin.

The plugin settings are located in the “Options” section - “FV Gravatar Cache”. I only changed the size of the avatar, setting it to 32 px. I left the rest of the settings unchanged.

That's all, thanks for your attention! Don’t forget to subscribe to the blog’s news feed, because there is still a lot of useful and interesting things to come. Take care of yourself!

If you have one on your blog/website, then you probably noticed different icons and photos there for user profiles. These avatars in WordPress are implemented using one useful service called Gravatar. Any user on the network can link their mail to a specific picture, after which it will be shown on all sites on the network that support this option. WordPress developers simply could not help but add this functionality to the system.

You will find all the relevant settings in the “Settings” - “Discussion” section at the very bottom of the page. There you can enable display, determine the rating of displayed icons, and set a baseline value for users without Gravatar. We’ll talk about the last point today - we’ll look at how to change default WordPress avatars. You have a couple of options to choose from:

This can be a standard service logo, as well as a couple of empty and automatic options. After installing and saving the settings, you will see the specified option on the website.

Auto-generated images look, in principle, not bad, but you can make your project a little more original and add your own unique Wordpress user avatars.

The algorithm for solving the problem consists of several simple steps:

1. Upload an avatar to WordPress

An image is added to WP in two ways: via FTP (FileZilla for example) or directly in the system. In the first case, you can place the image in any directory on the site; in the second, it will automatically go to the media library (wp-content/uploads).

The image must be square; in my template, images larger than 80x80 are not displayed, but some developers use larger sizes, up to 250x250 (although I don’t see much point in this).

Let's consider the option of downloading through the admin panel, since it is more visual for users. Select “Add New” in the “Media Files” section.

On the page that opens, use the “Select files” button or simply drag the file into the specified field. When the download is complete, you will see the added image. You need to click on the “Change” link, which is located to the right of the name (see picture above). After this, the following window will open:

Here you just need to copy the address of the future WordPress avatar, which is located in the “File Link” line.

2. Implementation of a hack/snippet

Traditionally, we add the snippet to the functions.php file. If you are new to this business, I advise you to read or use. Hack code:

add_filter( "avatar_defaults" , "setnew_gravatar" ) ; function setnew_gravatar ($avatar_defaults) ( $myavatar = "http://your_site/wp-content/uploads/new_avatar.png"; $avatar_defaults [ $myavatar ] = "New avatar" ; return $avatar_defaults ; )

add_filter("avatar_defaults", "setnew_gravatar"); function setnew_gravatar ($avatar_defaults) ( $myavatar = "http://your_site/wp-content/uploads/new_avatar.png"; $avatar_defaults[$myavatar] = "New avatar"; return $avatar_defaults; )

Important! For a variable $myavatar you need to provide a link to the file you downloaded. The next line sets the name of the default WordPress avatar, which will be displayed in the admin panel.

3. Changing settings

The next step is to change your avatar in WordPress system settings. To do this, go to the “Settings” - “Discussion” section, where at the very bottom of the page you will find a new element.

This is perhaps the simplest step of the algorithm. After this, all that remains is to go to the site and check the display of new icons. Don't forget to clear the cache if you have it in your project!

4. Possible errors

To be honest, my first attempt to install new WordPress user avatars was not successful. After all the changes, the site continued to display the standard Gravatar logo. If you have a similar situation, then look in the template files for the function get_avatar(presumably in comments.php or functions.php). It is she who displays the avatar icons. Make sure that when calling it, the $default parameter is not used, but only the first two are specified:

In my case, this option was specified in the function, so the corresponding picture was displayed, and any settings inside the admin panel were ignored. This, in principle, once again shows that not all themes are initially suitable for implementing the task - sometimes you have to slightly tweak the code.

Total. Basically, you can see that changing default user avatars in WordPress is not that difficult. The main thing is to consistently and carefully follow all the steps of the algorithm and do not forget to clear the cache at the end. If you have any questions, write in the comments.

A short note on how to set an arbitrary picture as your default avatar. There are at least three options for doing this. Which one is better suited in a particular situation is written below.

The gravatar service is not very popular, especially in RuNet. Therefore, many comments remain without ava. For such cases, so that the dummies are not the same, you can set dynamic avatars (all kinds of monsters) in the WordPress settings.

But sometimes, you need to be “on brand” for your site and set a custom avatar by default. This post is exactly for such cases.

Please note that the default image set will only be shown if the user does not have an avatar. And then there is confusion during testing...

Option 1: add a setting (new default avatar) to the admin panel

The code below will add one more, additional avatar option when selecting the default avatar in the admin panel, in the discussion settings.

## Adds another default avatar option to the discussion settings ## The avatar file "def-avatar.jpg" must be uploaded to the theme folder "img" add_filter("avatar_defaults", "add_default_avatar_option"); function add_default_avatar_option($avatars)( $url = get_stylesheet_directory_uri() . "/img/def-avatar.jpg"; $avatars[ $url ] = "Site Avatar"; return $avatars; )

As a result we get:

Note: you can find out which default avatar is currently selected by getting the value of the "avatar_default" option - get_option("avatar_default") .

The disadvantage of this method is that you cannot simply install the code, but you also need to “go” to the admin panel and enable the default avatar. This approach may simply be unacceptable when you need to strictly set an ava so that it cannot be changed... Or when you need the specified ava to always be the default, regardless of who and what has been set there in the settings.

I wrote the second version especially for such cases. And it turned out to be useful, it’s not as simple as I expected, but this is a lyric that no one needs, so we’ll skip it...

Option 2: specify the default avatar “on the fly”, through a filter

This option sets the default ava immediately after inserting the code and does not allow you to change the ava setting in the admin panel.

The hook takes into account the default parameter specified in the functions for displaying or getting an avatar. Those. for example, if you call the get_avatar() function with the default parameter, the avatar specified in the default parameter will be displayed, and not the one specified in the hook.

## Sets the default avatar ## The avatar file "def-avatar.jpg" must be placed in the theme folder "img" add_filter("pre_get_avatar_data", "replace_default_avatar"); function replace_default_avatar($args)( // admin panel and discussion page where the default avatar is configured... // if(is_admin() && get_current_screen()->base === "options-discussion") return $args; static $defava; if($defava === null) $defava = get_option("avatar_default", "mystery"); // speed up // If the default ava is used, the "default" parameter will work // if it is set for functions avatars if(! $args["default"] || $defava == $args["default"])( $args["default"] = get_stylesheet_directory_uri() . "/img/def-avatar.jpg"; ) return $args; )

Option 3: specify a link to the default avatar when calling the function

This is perhaps the most inflexible option. I don't remember ever using it. But it can definitely come in handy...

In order to get an avatar or its data there are three functions:

  • get_avatar() - Gets html code of the commentator's avatar.
  • get_avatar_data() - Retrieves an array of avatar data.
  • get_avatar_url() - Retrieves the avatar URL from the supplied email, ID or user object.

In each of them, you can specify the default parameter and thus set the default avatar URL. I will give an example for each function where the default parameter is specified:

Echo get_avatar(" [email protected]", 48, "http://example.com/default-avatar.png"); $ava_data = get_avatar_data(" [email protected]", array("size" => 48, "default" => "http://example.com/default-avatar.png",)); echo $ava_data["url"]; $url = get_avatar_url(" [email protected]", array("size" => 48, "default" => "http://example.com/default-avatar.png",)); echo $url;