{"id":139661,"date":"2015-10-15T11:00:53","date_gmt":"2015-10-15T16:00:53","guid":{"rendered":"https:\/\/getflywheel.com\/?p=13502"},"modified":"2023-03-29T15:51:43","modified_gmt":"2023-03-29T20:51:43","slug":"gravatars-in-wordpress-what-are-they-and-how-to-use-them","status":"publish","type":"resource","link":"https:\/\/wpengine.com\/case-studies\/resources\/gravatars-in-wordpress-what-are-they-and-how-to-use-them\/","title":{"rendered":"Gravatars in WordPress: What are They and How to Use Them"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">What are Gravatars?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">We\u2019re all familiar with the concept of avatars, which are the pictures next to a person\u2019s name, often a photo of them. WordPress utilizes this concept, but refers to them as Gravatars. The added letters of \u201cGr\u201d expand on this idea as a \u201cglobally recognized avatar.\u201d These Gravatars make it easy to follow users and appear when users write or comment on a website with this feature enabled.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/getflywheel-images.s3.us-east-2.amazonaws.com\/uploads\/2015\/10\/gravatar-example.jpg\" alt=\"gravatar-example\" class=\"wp-image-13515\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">How do I Get my Gravatar?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">WordPress loves Gravatars, so they are integrated into many WordPress websites by default. To start seeing your Gravatar, you will have to sign up for one first. To sign up for your Gravatar, go to the <a href=\"https:\/\/en.gravatar.com\/site\/signup\/\" target=\"_blank\" rel=\"noopener noreferrer\">Gravatar signup page<\/a> and create your account. If you have &nbsp;Wordpress.com credentials, you\u2019ll use those to sign up. If not, you will need to create a new account.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Take notice that it is WordPress.com and not WordPress.org. Even if you\u2019re an avid WordPress user, you may not necessarily use WordPress.com. If you do not rely on their self-hosted solution, you will need to create an account to get your Gravatar.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/getflywheel-images.s3.us-east-2.amazonaws.com\/uploads\/2015\/10\/gravatar-signup.png\" alt=\"gravatar-signup\" class=\"wp-image-13516\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">After you have entered your email account and have gone through the signup process, you will need to check your email and click the activation link. Remember to choose a name and password so you can sign in for future use.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Uploading photos is pretty self-explanatory, but keep in mind that any photo you choose will need to be cropped so it fits in the square format. Also, you will have to give your photo a rating; assuming all is appropriate, \u201cG\u201d should be chosen.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Gravatar Specifics<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In addition to your name and details, there are other options which you can choose to include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Photo gallery<\/li>\n\n\n\n<li>Links to your websites and blogs<\/li>\n\n\n\n<li>Background color for your profile area when it shows up on blogs and other places<\/li>\n\n\n\n<li>More detailed contact information<\/li>\n\n\n\n<li>Verified services like social media accounts and other blogging platforms<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Are you a photo superstar who looks good from more than one angle? If so, don\u2019t worry, you can have more than one photo and it\u2019s easy to change. Any time you want to change it, all you have to do is log into your Gravatar account and then change your profile picture.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Where will Gravatars be Shown?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you&#8217;re a frequent blog commenter, you will see you Gravatar every time you use that email address to comment on a blog. Think of all those comment chains that you see at the bottom of a blog post. Quite often most people have an image that shows up, so they have gone through the Gravatar process. If not, it\u2019s usually just a default icon set by the Administrator, a gray silhouette most likely. On occasion, you will come across a blog that does not have avatar images, so it\u2019s important to note that the blog needs to be Gravatar-enabled for it to show up.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/getflywheel-images.s3.us-east-2.amazonaws.com\/uploads\/2015\/10\/gravatar-gallery.jpg\" alt=\"gravatar-gallery\" class=\"wp-image-13517\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If it is enabled, your chosen image will automagically appear next to your comment. Your profile is matched to this email address, so your profile is matched with your name and custom image, and any other information that is allowed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Have you been using a registered Gravatar and wondered how your WordPress site has a picture of you when you log in? WordPress sites use Gravatars for their internal User profiles. If you use the same credentials as you do with your Gravatar account, you\u2019ll see a tiny version of that image on the right side of your admin bar, right next to the \u201cHowdy.\u201d Also, this will appear next to your username on the <b>Users &gt; All Users<\/b> screen.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here is an example from my personal site, where I am the admin:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/getflywheel-images.s3.us-east-2.amazonaws.com\/uploads\/2015\/10\/gravatar-admin.jpg\" alt=\"gravatar-admin\" class=\"wp-image-13518\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Here is one for a site where I\u2019m an editor only. It\u2019s a great advantage in both cases because there\u2019s no need to go through the step of having to upload a photo every time.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/getflywheel-images.s3.us-east-2.amazonaws.com\/uploads\/2015\/10\/gravatar-editor.jpg\" alt=\"gravatar-editor\" class=\"wp-image-13519\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">What are the Benefits of Gravatars?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Providing your users with avatars has become a convention in web-publishing, and it\u2019s good to provide that personal connection. Can you picture the faces of your favorite bloggers? Does putting a face with a name make them easier to trust? Our profile images are everywhere, and that is part of how we leave our digital footprints. If you\u2019re a site owner, editor, blogger, or just a commenter with something to say, having an avatar next to your name helps you look more professional and it is always good to put a name with a face.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><b>Traffic benefits<\/b><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Having Gravatars set up can help send traffic to your website. If someone is interested in a comment, people do sometimes click the link to a website. This doesn\u2019t happen all the time, but it is more likely to happen if there is a Gravatar picture. If you are a well-known author or commentator, your comments are sure to stand out&nbsp;and are more likely to be a source of traffic to your website.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Using Gravatars on a Site<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Enabling Gravatars on your WordPress site makes for a simpler process for your users. So now that <i>you<\/i> have a Gravatar, how can you be sure your users will be able to see their Gravatars in action on your site?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><b>Enabling Gravatars<\/b><br>Enabling Gravatars can be done in just a few simple steps if the functionality is included in your theme.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Log in as an administrator to your site.<\/li>\n\n\n\n<li>Go to <b>Settings &gt; Discussion<\/b> and scroll down to the \u201cAvatar\u201d Section<\/li>\n\n\n\n<li>Choose from the options in the \u00a0\u201cAvatar\u201d sections:\n<ul class=\"wp-block-list\">\n<li>Avatar display: Choose if Gravatars are turned on or off.<\/li>\n\n\n\n<li>Maximum rating: Remember when we talked about the photo rating when you sign up? This is for the maximum rating for display.<\/li>\n\n\n\n<li>Default avatar: Select what image you would like to display when there is no Gravatar image to show.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/getflywheel-images.s3.us-east-2.amazonaws.com\/uploads\/2015\/10\/gravatar-options.jpg\" alt=\"gravatar-options\" class=\"wp-image-13520\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Adding Gravatar Option to a Theme<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Gravatar functionality comes with the WordPress 2015 Theme, but if you are creating something new or need to add it to an existing theme that does not have Gravatar functionality built in, it is easy to add the needed functions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, you will need to become familiar with the <code>get_avatar()<\/code> function. This is what \u201cgets\u201d the Gravatar. This function uses four parameters: Two are required and the other two are not.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here\u2019s what it looks like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo get_avatar( $id_or_email, $size, $default, $alt );<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><b>What do the Parameters Mean?<\/b><\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><code>$id_or_email<\/code> &#8211; ID or the email address of the user. (Required)<\/li>\n\n\n\n<li><code>$size<\/code> &#8211; The size of the avatar; by default it\u2019s 96 which means the avatar will be 96px in height and 96px in width. (Required)<\/li>\n\n\n\n<li><code>$default<\/code> &#8211; Using this parameter, you can set a default image to be used if the user does not have a gravatar. Basically, it\u2019s a URL\/path to the image. (Optional)<\/li>\n\n\n\n<li><code>$alt<\/code> &#8211; Alt text for the image. (Optional)<\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\"><b>For Posts<\/b><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s take a look at the function in action. It makes sense that this would be available on post pages for the author.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To display the Gravatar of the author of an article, simply add the following lines into your while loop on <code>single.php<\/code> or wherever you want to use it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&amp;lt;?php\n\n$user_email = get_the_author_meta('user_email');\n\n\/\/ this is the post author's e-mail address\n\n$user_id = get_the_author_meta('id');\n\n\/\/ this is the post author's ID\n\n\/\/ Use this function to display the avatar wherever you want.\n\necho get_avatar( $id_or_email, $size = '96', $default = '&amp;amp;amp;lt;path_to_url&amp;amp;amp;gt;' );\n\n?&amp;gt;<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><b>For Comments<\/b><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><br>To display Gravatars for comments, add this to the code into your comments function.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Comments need this to display the Gravatar of each person who adds a comment.\n\n&amp;lt;?php echo get_avatar( $comment, 40 ); ?&amp;gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This covered the basics of Gravatars, but there is no better way to test it out than to try it yourself. Now that you have an idea of how to create and use Gravatars on your site, there\u2019s only one thing left to do. Put it to good use and make your mark with your Gravatar!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What are Gravatars? We\u2019re all familiar with the concept of avatars, which are the pictures next to a person\u2019s name, often a photo of them. WordPress utilizes this concept, but refers to them as Gravatars. The added letters of \u201cGr\u201d expand on this idea as a \u201cglobally recognized avatar.\u201d These Gravatars make it easy to<span class=\"tile__ellipses\">&hellip;<\/span><span class=\"tile__ellipses--animated\"><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"template":"","resource-topic":[912],"resource-role":[896],"resource-type":[916],"class_list":["post-139661","resource","type-resource","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Gravatars in WordPress: What are They and How to Use Them<\/title>\n<meta name=\"description\" content=\"Gravatars are a great way to associate your face and name with your work. This article goes through what they are and how to use them.\" \/>\n<meta name=\"robots\" content=\"noindex, follow\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Gravatars in WordPress: What are They and How to Use Them\" \/>\n<meta property=\"og:description\" content=\"Gravatars are a great way to associate your face and name with your work. This article goes through what they are and how to use them.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wpengine.com\/case-studies\/resources\/gravatars-in-wordpress-what-are-they-and-how-to-use-them\/\" \/>\n<meta property=\"og:site_name\" content=\"WP Engine\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/wpengine\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-29T20:51:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/getflywheel-images.s3.us-east-2.amazonaws.com\/uploads\/2015\/10\/gravatar-example.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@wpengine\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/resources\/gravatars-in-wordpress-what-are-they-and-how-to-use-them\/\",\"url\":\"https:\/\/wpengine.com\/case-studies\/resources\/gravatars-in-wordpress-what-are-they-and-how-to-use-them\/\",\"name\":\"Gravatars in WordPress: What are They and How to Use Them\",\"isPartOf\":{\"@id\":\"https:\/\/wpengine.com\/case-studies\/#website\"},\"datePublished\":\"2015-10-15T16:00:53+00:00\",\"dateModified\":\"2023-03-29T20:51:43+00:00\",\"description\":\"Gravatars are a great way to associate your face and name with your work. This article goes through what they are and how to use them.\",\"breadcrumb\":{\"@id\":\"https:\/\/wpengine.com\/case-studies\/resources\/gravatars-in-wordpress-what-are-they-and-how-to-use-them\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/wpengine.com\/case-studies\/resources\/gravatars-in-wordpress-what-are-they-and-how-to-use-them\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/resources\/gravatars-in-wordpress-what-are-they-and-how-to-use-them\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/wpengine.com\/case-studies\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Resources\",\"item\":\"https:\/\/wpengine.com\/case-studies\/resources\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Gravatars in WordPress: What are They and How to Use Them\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#website\",\"url\":\"https:\/\/wpengine.com\/case-studies\/\",\"name\":\"WP Engine\",\"description\":\"Managed Hosting for WordPress\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/wpengine.com\/case-studies\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/f5301455463371a10d1fc290e9ad0085\",\"name\":\"WP Engine\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d8770fe9625ca7c4601f13d9d0ab86565a6dac8cd6a77bfe2ada6d83c6837870?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d8770fe9625ca7c4601f13d9d0ab86565a6dac8cd6a77bfe2ada6d83c6837870?s=96&d=mm&r=g\",\"caption\":\"WP Engine\"},\"sameAs\":[\"https:\/\/wpengine.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Gravatars in WordPress: What are They and How to Use Them","description":"Gravatars are a great way to associate your face and name with your work. This article goes through what they are and how to use them.","robots":{"index":"noindex","follow":"follow"},"og_locale":"en_US","og_type":"article","og_title":"Gravatars in WordPress: What are They and How to Use Them","og_description":"Gravatars are a great way to associate your face and name with your work. This article goes through what they are and how to use them.","og_url":"https:\/\/wpengine.com\/case-studies\/resources\/gravatars-in-wordpress-what-are-they-and-how-to-use-them\/","og_site_name":"WP Engine","article_publisher":"https:\/\/www.facebook.com\/wpengine","article_modified_time":"2023-03-29T20:51:43+00:00","og_image":[{"url":"https:\/\/getflywheel-images.s3.us-east-2.amazonaws.com\/uploads\/2015\/10\/gravatar-example.jpg"}],"twitter_card":"summary_large_image","twitter_site":"@wpengine","twitter_misc":{"Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wpengine.com\/case-studies\/resources\/gravatars-in-wordpress-what-are-they-and-how-to-use-them\/","url":"https:\/\/wpengine.com\/case-studies\/resources\/gravatars-in-wordpress-what-are-they-and-how-to-use-them\/","name":"Gravatars in WordPress: What are They and How to Use Them","isPartOf":{"@id":"https:\/\/wpengine.com\/case-studies\/#website"},"datePublished":"2015-10-15T16:00:53+00:00","dateModified":"2023-03-29T20:51:43+00:00","description":"Gravatars are a great way to associate your face and name with your work. This article goes through what they are and how to use them.","breadcrumb":{"@id":"https:\/\/wpengine.com\/case-studies\/resources\/gravatars-in-wordpress-what-are-they-and-how-to-use-them\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wpengine.com\/case-studies\/resources\/gravatars-in-wordpress-what-are-they-and-how-to-use-them\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/wpengine.com\/case-studies\/resources\/gravatars-in-wordpress-what-are-they-and-how-to-use-them\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wpengine.com\/case-studies\/"},{"@type":"ListItem","position":2,"name":"Resources","item":"https:\/\/wpengine.com\/case-studies\/resources\/"},{"@type":"ListItem","position":3,"name":"Gravatars in WordPress: What are They and How to Use Them"}]},{"@type":"WebSite","@id":"https:\/\/wpengine.com\/case-studies\/#website","url":"https:\/\/wpengine.com\/case-studies\/","name":"WP Engine","description":"Managed Hosting for WordPress","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wpengine.com\/case-studies\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/f5301455463371a10d1fc290e9ad0085","name":"WP Engine","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d8770fe9625ca7c4601f13d9d0ab86565a6dac8cd6a77bfe2ada6d83c6837870?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d8770fe9625ca7c4601f13d9d0ab86565a6dac8cd6a77bfe2ada6d83c6837870?s=96&d=mm&r=g","caption":"WP Engine"},"sameAs":["https:\/\/wpengine.com"]}]}},"acf":[],"grid_image_url":"https:\/\/wpengine.com\/case-studies\/wp-content\/themes\/wpengine-breakthrough\/images\/fallback\/default-grid-resource.jpg","media-type":{"term_id":916,"name":"Article","slug":"article"},"role":"<strong>Roles:<\/strong> Developer","topic":"<strong>Topics:<\/strong> Performance","_links":{"self":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource\/139661","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource"}],"about":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/types\/resource"}],"author":[{"embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/users\/1"}],"wp:attachment":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/media?parent=139661"}],"wp:term":[{"taxonomy":"resource-topic","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-topic?post=139661"},{"taxonomy":"resource-role","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-role?post=139661"},{"taxonomy":"resource-type","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-type?post=139661"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}