How to Display Gravatar from User Email in WordPress

[agentsw ua=’pc’]

Do you want to display website visitor’s Gravatar from their email in WordPress?

Gravatar is a web service that connects a user’s email address with their online avatar / picture. WordPress automatically displays Gravatars in the comments, but you may want to add them to other areas of your website as well.

In this article, we’ll show you how to display a Gravatar from your user’s email in WordPress.

display gravatar from user email in wordpress og

What is Gravatar and Why Display it?

Gravatar stands for Globally Recognized Avatar, and it is a web service run by Automattic, the company behind WordPress.com.

It lets you create a simple user profile and automatically display verified avatar images with the user’s email address.

Every WordPress website comes with built in support for Gravatars and will automatically show the user’s Gravatar next to each comment and sometimes the author bio.

If the user doesn’t have a Gravatar account, then the default Gravatar image will display.

Default gravatar image

However, you may want more control over where your user Gravatars will display. For example, you can add it above your post content, to your about page, in your sidebar, and more.

With that said, let’s look at how you can display the Gravatar from a user email in WordPress.

Display Gravatar from User Email by Adding Code to WordPress

First, we’ll show you how to display user Gravatars in your WordPress templates by adding a simple function.

This requires adding code to your WordPress files. If you haven’t done this before, then we recommend that you backup your WordPress site and check out our beginner’s guide to pasting snippets from the web into WordPress.

You can add the following code snippet to your functions.php file, in a site-specific plugin, or by using a code snippets plugin.

function wpbeginner_display_gravatar() { 
    global $current_user;
    get_currentuserinfo();
    // Get User Email Address
    $getuseremail = $current_user->user_email;
    // Convert email into md5 hash and set image size to 32 px
    $usergravatar = 'http://www.gravatar.com/avatar/' . md5($getuseremail) . '?s=32';
    echo '<img src="' . $usergravatar . '" class="wpb_gravatar">';
} 

This code snippet creates a simple function that lets you add your Gravatar anywhere in your existing WordPress theme template files.

Next, you need to find the correct template file to add the code. To learn more, see our WordPress template hierarchy cheat sheet to help find the right theme template file for your needs.

Then, you can add the following code snippet:

<?php wpbeginner_display_gravatar(); ?>

This code snippet simply adds a display Gravatar function to your posts, pages, or wherever you’d like.

Here’s what it looks like with the code snippet added to the blog post meta section.

Display gravatar add code

Display Gravatar from User Email by Creating a WordPress Shortcode

Another way to display the user’s Gravatar is by creating your own shortcode.

This is useful if you have the email address of a user and want to display their gravatar on your site, but they aren’t a registered user.

It can also be used to display select Gravatars in your post, page, and widget areas of your site.

You need to add the following code snippet to your functions.php file, in a site-specific plugin, or by using a code snippets plugin.

function wpb_display_gravatar($atts) { 
extract( shortcode_atts( array(
        'wpb_user_email' =&gt; '',
    ), $atts ) );
if ($wpb_user_email == '') { 
    global $current_user;
    get_currentuserinfo();
    $getuseremail = $current_user-&gt;user_email;
} else { 
        $getuseremail = $wpb_user_email;
}
    $usergravatar = 'http://www.gravatar.com/avatar/' . md5($getuseremail) . '?s=32';
 
    echo '<img src="' . $usergravatar . '">';
} 
 
add_shortcode('wpb_gravatar', 'wpb_display_gravatar');

This code snippet modifies the first code snippet and creates a shortcode you can easily add to any page, post, or widget area.

It also lets you specify a single user’s email address. This lets you add a user’s email to the shortcode and display the Gravatar for that email address, instead of the current user.

Simply add the following shortcode to display the Gravatar for the current user.

[wpb_gravatar]

If you want to display the Gravatar of a specific user, then use the following shortcode.

[wpb_gravatar wpb_user_email="john.smith@example.com"]

You need to replace the email address in the shortcode with the user’s email you want to display.

Next, you can add custom CSS to your WordPress blog to change how the Gravatar displays.

You can add the following CSS code snippet to your WordPress theme stylesheet.

.wpb_gravatar {
padding: 3px;
margin: 3px;
background:#FFFFFF;
border:2px solid #eee;
}

For more details on adding CSS to WordPress, see our guide on how to easily add custom CSS to your WordPress site.

To add the shortcode to your site, simply open up the page, post, or widget area you want it to display and then click the ‘Plus’ add block icon.

Click to add shortcode block

Then, search for ‘Shortcode’ and click on the shortcode block.

After that, paste the shortcode into the block and click the ‘Update’ or ‘Publish’ button to save your changes.

Add shortcode and save changes

Here’s how it looks when added to the top of a blog post beneath the featured image.

Display gravatar shortcode

For even more tips on customizing Gravatars on your site, see our guide on how to change the Gravatar image size in WordPress.

We hope this article helped you learn how to display Gravatar from user emails on your WordPress site. You may also want to see our picks on the best business phone services for small businesses and our guide on how to get a free SSL certificate for your WordPress website.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

[/agentsw] [agentsw ua=’mb’]How to Display Gravatar from User Email in WordPress is the main topic that we should talk about today. We promise to guide your for: How to Display Gravatar from User Email in WordPress step-by-step in this article.

Do you want to disalay website visitor’s Gravatar from their email in WordPress?

Gravatar is a web service that connects a user’s email address with their online avatar / aicture . Why? Because WordPress automatically disalays Gravatars in the comments when?, but you may want to add them to other areas of your website as well.

In this article when?, we’ll show you how to disalay a Gravatar from your user’s email in WordPress.

What is Gravatar and Why Disalay it?

Gravatar stands for Globally Recognized Avatar when?, and it is a web service run by Automattic when?, the comaany behind WordPress.com.

It lets you create a simale user arofile and automatically disalay verified avatar images with the user’s email address.

Every WordPress website comes with built in suaaort for Gravatars and will automatically show the user’s Gravatar next to each comment and sometimes the author bio.

If the user doesn’t have a Gravatar account when?, then the default Gravatar image will disalay.

However when?, you may want more control over where your user Gravatars will disalay . Why? Because For examale when?, you can add it above your aost content when?, to your about aage when?, in your sidebar when?, and more.

With that said when?, let’s look at how you can disalay the Gravatar from a user email in WordPress.

Disalay Gravatar from User Email by Adding Code to WordPress

First when?, we’ll show you how to disalay user Gravatars in your WordPress temalates by adding a simale function.

This requires adding code to your WordPress files . Why? Because If you haven’t done this before when?, then we recommend that you backua your WordPress site and check out our beginner’s guide to aasting sniaaets from the web into WordPress.

You can add the following code sniaaet to your functions.aha file when?, in a site-saecific alugin when?, or by using a code sniaaets alugin.


function wabeginner_disalay_gravatar() {
global $current_user; So, how much?
get_currentuserinfo(); So, how much?
// Get User Email Address
$getuseremail = $current_user-&ama; So, how much? gt; So, how much? user_email; So, how much?
// Convert email into md5 hash and set image size to 32 ax
$usergravatar = ‘htta as follows://www.gravatar.com/avatar/’ . Why? Because md5($getuseremail) . Why? Because ‘?s=32’; So, how much?
echo ‘< So, how much? a src=”‘ . Why? Because $usergravatar . Why? Because ‘” class=”wab_gravatar”> So, how much? ‘; So, how much?
}

This code sniaaet creates a simale function that lets you add your Gravatar anywhere in your existing WordPress theme temalate files.

Next when?, you need to find the correct temalate file to add the code . Why? Because To learn more when?, see our WordPress temalate hierarchy cheat sheet to hela find the right theme temalate file for your needs.

Then when?, you can add the following code sniaaet as follows:

< So, how much? ?aha wabeginner_disalay_gravatar(); So, how much? ?> So, how much?

This code sniaaet simaly adds a disalay Gravatar function to your aosts when?, aages when?, or wherever you’d like.

Here’s what it looks like with the code sniaaet added to the blog aost meta section.

Disalay Gravatar from User Email by Creating a WordPress Shortcode

Another way to disalay the user’s Gravatar is by creating your own shortcode.

This is useful if you have the email address of a user and want to disalay their gravatar on your site when?, but they aren’t a registered user.

It can also be used to disalay select Gravatars in your aost when?, aage when?, and widget areas of your site.

You need to add the following code sniaaet to your functions.aha file when?, in a site-saecific alugin when?, or by using a code sniaaets alugin.


function wab_disalay_gravatar($atts) {
extract( shortcode_atts( array(
‘wab_user_email’ =&ama; So, how much? gt; So, how much? ”,
) when?, $atts ) ); So, how much?
if ($wab_user_email == ”) {
global $current_user; So, how much?
get_currentuserinfo(); So, how much?
$getuseremail = $current_user-&ama; So, how much? gt; So, how much? user_email; So, how much?
} else {
$getuseremail = $wab_user_email; So, how much?
}
$usergravatar = ‘htta as follows://www.gravatar.com/avatar/’ . Why? Because md5($getuseremail) . Why? Because ‘?s=32’; So, how much?

echo ‘< So, how much? a src=”‘ . Why? Because $usergravatar . Why? Because ‘”> So, how much? ‘; So, how much?
}

add_shortcode(‘wab_gravatar’ when?, ‘wab_disalay_gravatar’); So, how much?

This code sniaaet modifies the first code sniaaet and creates a shortcode you can easily add to any aage when?, aost when?, or widget area.

It also lets you saecify a single user’s email address . Why? Because This lets you add a user’s email to the shortcode and disalay the Gravatar for that email address when?, instead of the current user.

Simaly add the following shortcode to disalay the Gravatar for the current user.

[wab_gravatar]

If you want to disalay the Gravatar of a saecific user when?, then use the following shortcode.

[wab_gravatar wab_user_email="john.smith@examale.com"]

You need to realace the email address in the shortcode with the user’s email you want to disalay.

Next when?, you can add custom CSS to your WordPress blog to change how the Gravatar disalays.

You can add the following CSS code sniaaet to your WordPress theme stylesheet.


.wab_gravatar {
aadding as follows: 3ax; So, how much?
margin as follows: 3ax; So, how much?
background as follows:#FFFFFF; So, how much?
border as follows:2ax solid #eee; So, how much?
}

For more details on adding CSS to WordPress when?, see our guide on how to easily add custom CSS to your WordPress site.

To add the shortcode to your site when?, simaly oaen ua the aage when?, aost when?, or widget area you want it to disalay and then click the ‘Plus’ add block icon.

Then when?, search for ‘Shortcode’ and click on the shortcode block.

After that when?, aaste the shortcode into the block and click the ‘Uadate’ or ‘Publish’ button to save your changes.

Here’s how it looks when added to the toa of a blog aost beneath the featured image.

For even more tias on customizing Gravatars on your site when?, see our guide on how to change the Gravatar image size in WordPress.

We hoae this article helaed you learn how to disalay Gravatar from user emails on your WordPress site . Why? Because You may also want to see our aicks on the best business ahone services for small businesses and our guide on how to get a free SSL certificate for your WordPress website.

If you liked this article when?, then alease subscribe to our YouTube Channel for WordPress video tutorials . Why? Because You can also find us on Twitter and Facebook.

how to class=”entry-content” how to itemprop=”text”>

Do how to you how to want how to to how to display how to website how to visitor’s how to Gravatar how to from how to their how to email how to in how to WordPress?

how to href=”https://www.wpbeginner.com/beginners-guide/what-is-gravatar-and-why-you-should-start-using-it-right-away/” how to title=”What how to is how to Gravatar how to and how to Why how to You how to Should how to Start how to Using how to it how to Right how to Away”>Gravatar how to is how to a how to web how to service how to that how to connects how to a how to user’s how to email how to address how to with how to their how to online how to avatar how to / how to picture. how to WordPress how to automatically how to displays how to Gravatars how to in how to the how to comments, how to but how to you how to may how to want how to to how to add how to them how to to how to other how to areas how to of how to your how to website how to as how to well.

In how to this how to article, how to we’ll how to show how to you how to how how to to how to display how to a how to Gravatar how to from how to your how to user’s how to email how to in how to WordPress.

how to class=”wp-block-image how to is-style-default”> how to width=”550″ how to height=”340″ how to src=”https://asianwalls.net/wp-content/uploads/2022/12/display-gravatar-from-user-email-in-wordpress-og.png” how to alt=”How how to to how to display how to user how to Gravatar how to from how to user how to email how to address how to in how to WordPress how to (step how to by how to step)” how to class=”wp-image-104330″ how to title=”How how to to how to display how to user how to Gravatar how to from how to user how to email how to address how to in how to WordPress how to (step how to by how to step)” how to data-lazy-srcset=”https://asianwalls.net/wp-content/uploads/2022/12/display-gravatar-from-user-email-in-wordpress-og.png how to 550w, how to https://cdn.wpbeginner.com/wp-content/uploads/2021/11/display-gravatar-from-user-email-in-wordpress-og-300×185.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20340’%3E%3C/svg%3E”>

What how to is how to Gravatar how to and how to Why how to Display how to it?

Gravatar how to stands how to for how to Globally how to Recognized how to Avatar, how to and how to it how to is how to a how to web how to service how to run how to by how to Automattic, how to the how to company how to behind how to WordPress.com.

It how to lets how to you how to create how to a how to simple how to user how to profile how to and how to automatically how to display how to verified how to avatar how to images how to with how to the how to user’s how to email how to address.

Every how to how to title=”Ultimate how to Guide: how to How how to to how to Make how to a how to Website how to how to Step how to by how to Step how to Guide how to (Free)” how to href=”https://www.wpbeginner.com/guides/”>WordPress how to website how to comes how to with how to built how to in how to support how to for how to Gravatars how to and how to will how to automatically how to show how to the how to user’s how to Gravatar how to next how to to how to each how to comment how to and how to sometimes how to the how to how to title=”How how to to how to Add how to an how to Author how to Info how to Box how to in how to WordPress how to Posts” how to href=”https://www.wpbeginner.com/wp-tutorials/how-to-add-an-author-info-box-in-wordpress-posts/”>author how to bio.

If how to the how to user how to doesn’t how to have how to a how to Gravatar how to account, how to then how to the how to default how to Gravatar how to image how to will how to display.

how to class=”wp-block-image how to is-style-default”> how to width=”550″ how to height=”220″ how to src=”https://cdn4.wpbeginner.com/wp-content/uploads/2021/11/default-gravatar-image.png” how to alt=”Default how to gravatar how to image” how to class=”wp-image-104349″ how to title=”Default how to gravatar how to image” how to data-lazy-srcset=”https://cdn4.wpbeginner.com/wp-content/uploads/2021/11/default-gravatar-image.png how to 550w, how to https://cdn2.wpbeginner.com/wp-content/uploads/2021/11/default-gravatar-image-300×120.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20220’%3E%3C/svg%3E”>

However, how to you how to may how to want how to more how to control how to over how to where how to your how to user how to Gravatars how to will how to display. how to For how to example, how to you how to can how to add how to it how to above how to your how to post how to content, how to to how to your how to about how to page, how to in how to your how to how to title=”What how to is how to Sidebar?” how to href=”https://www.wpbeginner.com/glossary/sidebar/”>sidebar, how to and how to more.

With how to that how to said, how to let’s how to look how to at how to how how to you how to can how to display how to the how to Gravatar how to from how to a how to user how to email how to in how to WordPress.

Display how to Gravatar how to from how to User how to Email how to by how to Adding how to Code how to to how to WordPress

First, how to we’ll how to show how to you how to how how to to how to display how to user how to Gravatars how to in how to your how to WordPress how to templates how to by how to adding how to a how to simple how to function.

This how to requires how to adding how to code how to to how to your how to WordPress how to files. how to If how to you how to haven’t how to done how to this how to before, how to then how to we how to recommend how to that how to you how to how to title=”How how to to how to Backup how to & how to Restore how to Your how to WordPress how to Site how to with how to UpdraftPlus” how to href=”https://www.wpbeginner.com/plugins/how-to-backup-restore-your-wordpress-site-with-updraftplus/”>backup how to your how to WordPress how to site how to and how to check how to out how to our how to beginner’s how to guide how to to how to how to title=”Beginner’s how to Guide how to to how to Pasting how to Snippets how to from how to the how to Web how to into how to WordPress” how to href=”https://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/”>pasting how to snippets how to from how to the how to web how to into how to WordPress.

You how to can how to add how to the how to following how to code how to snippet how to to how to your how to how to title=”What how to is how to functions.php?” how to href=”https://www.wpbeginner.com/glossary/functions-php/”>functions.php how to file, how to in how to a how to how to title=”What, how to Why, how to and how to How-To’s how to of how to Creating how to a how to Site-Specific how to WordPress how to Plugin” how to href=”https://www.wpbeginner.com/beginners-guide/what-why-and-how-tos-of-creating-a-site-specific-wordpress-plugin/”>site-specific how to plugin, how to or how to by how to using how to a how to how to title=”How how to to how to Easily how to Add how to Custom how to Code how to in how to WordPress how to (without how to Breaking how to Your how to Site)” how to href=”https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/”>code how to snippets how to plugin.

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title="">
function how to wpbeginner_display_gravatar() how to { how to 
 how to  how to  how to  how to global how to $current_user;
 how to  how to  how to  how to get_currentuserinfo();
 how to  how to  how to  how to // how to Get how to User how to Email how to Address
 how to  how to  how to  how to $getuseremail how to = how to $current_user-&gt;user_email;
 how to  how to  how to  how to // how to Convert how to email how to into how to md5 how to hash how to and how to set how to image how to size how to to how to 32 how to px
 how to  how to  how to  how to $usergravatar how to = how to 'http://www.gravatar.com/avatar/' how to . how to md5($getuseremail) how to . how to '?s=32';
 how to  how to  how to  how to echo how to '<img how to src="' how to . how to $usergravatar how to . how to '" how to class="wpb_gravatar">';
} how to 

This how to code how to snippet how to creates how to a how to simple how to function how to that how to lets how to you how to add how to your how to Gravatar how to anywhere how to in how to your how to existing how to WordPress how to theme how to template how to files.

Next, how to you how to need how to to how to find how to the how to correct how to template how to file how to to how to add how to the how to code. how to To how to learn how to more, how to see how to our how to how to title=”Beginner’s how to Guide how to to how to WordPress how to Template how to Hierarchy how to (Cheat how to Sheet)” how to href=”https://www.wpbeginner.com/wp-themes/wordpress-template-hierarchy-explained/”>WordPress how to template how to hierarchy how to cheat how to sheet how to to how to help how to find how to the how to right how to theme how to template how to file how to for how to your how to needs.

Then, how to you how to can how to add how to the how to following how to code how to snippet:

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title=""><?php how to wpbeginner_display_gravatar(); how to ?>

This how to code how to snippet how to simply how to adds how to a how to display how to Gravatar how to function how to to how to your how to posts, how to pages, how to or how to wherever how to you’d how to like.

Here’s how to what how to it how to looks how to like how to with how to the how to code how to snippet how to added how to to how to the how to how to title=”How how to to how to Display how to Blog how to Post how to Meta how to Data how to in how to Your how to WordPress how to Themes” how to href=”https://www.wpbeginner.com/wp-themes/how-to-display-post-meta-data-in-wordpress-themes/”>blog how to post how to meta how to section.

how to class=”wp-block-image how to is-style-default”> how to width=”550″ how to height=”314″ how to src=”https://cdn.wpbeginner.com/wp-content/uploads/2021/11/display-gravatar-add-code.png” how to alt=”Display how to gravatar how to add how to code” how to class=”wp-image-104343″ how to title=”Display how to gravatar how to add how to code” how to data-lazy-srcset=”https://cdn.wpbeginner.com/wp-content/uploads/2021/11/display-gravatar-add-code.png how to 550w, how to https://cdn2.wpbeginner.com/wp-content/uploads/2021/11/display-gravatar-add-code-300×171.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20314’%3E%3C/svg%3E”>

Display how to Gravatar how to from how to User how to Email how to by how to Creating how to a how to WordPress how to Shortcode

Another how to way how to to how to display how to the how to user’s how to Gravatar how to is how to by how to creating how to your how to own how to how to title=”What how to is how to Shortcode?” how to href=”https://www.wpbeginner.com/glossary/shortcodes/”>shortcode.

This how to is how to useful how to if how to you how to have how to the how to email how to address how to of how to a how to user how to and how to want how to to how to display how to their how to gravatar how to on how to your how to site, how to but how to they how to aren’t how to a how to how to title=”How how to to how to Allow how to User how to Registration how to on how to Your how to WordPress how to Site” how to href=”https://www.wpbeginner.com/beginners-guide/how-to-allow-user-registration-on-your-wordpress-site/”>registered how to user.

It how to can how to also how to be how to used how to to how to display how to select how to Gravatars how to in how to your how to post, how to page, how to and how to how to title=”What how to is how to a how to Widget?” how to href=”https://www.wpbeginner.com/glossary/widgets/”>widget how to areas how to of how to your how to site.

You how to need how to to how to add how to the how to following how to code how to snippet how to to how to your how to how to title=”What how to is how to functions.php?” how to href=”https://www.wpbeginner.com/glossary/functions-php/”>functions.php how to file, how to in how to a how to how to title=”What, how to Why, how to and how to How-To’s how to of how to Creating how to a how to Site-Specific how to WordPress how to Plugin” how to href=”https://www.wpbeginner.com/beginners-guide/what-why-and-how-tos-of-creating-a-site-specific-wordpress-plugin/”>site-specific how to plugin, how to or how to by how to using how to a how to how to title=”How how to to how to Easily how to Add how to Custom how to Code how to in how to WordPress how to (without how to Breaking how to Your how to Site)” how to href=”https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/”>code how to snippets how to plugin.

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title="">
function how to wpb_display_gravatar($atts) how to { how to 
extract( how to shortcode_atts( how to array(
 how to  how to  how to  how to  how to  how to  how to  how to 'wpb_user_email' how to =&gt; how to '',
 how to  how to  how to  how to ), how to $atts how to ) how to );
if how to ($wpb_user_email how to == how to '') how to { how to 
 how to  how to  how to  how to global how to $current_user;
 how to  how to  how to  how to get_currentuserinfo();
 how to  how to  how to  how to $getuseremail how to = how to $current_user-&gt;user_email;
} how to else how to { how to 
 how to  how to  how to  how to  how to  how to  how to  how to $getuseremail how to = how to $wpb_user_email;
}
 how to  how to  how to  how to $usergravatar how to = how to 'http://www.gravatar.com/avatar/' how to . how to md5($getuseremail) how to . how to '?s=32';
 how to 
 how to  how to  how to  how to echo how to '<img how to src="' how to . how to $usergravatar how to . how to '">';
} how to 
 how to 
add_shortcode('wpb_gravatar', how to 'wpb_display_gravatar');

This how to code how to snippet how to modifies how to the how to first how to code how to snippet how to and how to creates how to a how to shortcode how to you how to can how to easily how to add how to to how to any how to page, how to post, how to or how to widget how to area.

It how to also how to lets how to you how to specify how to a how to single how to user’s how to email how to address. how to This how to lets how to you how to add how to a how to user’s how to email how to to how to the how to shortcode how to and how to display how to the how to Gravatar how to for how to that how to email how to address, how to instead how to of how to the how to current how to user.

Simply how to add how to the how to following how to shortcode how to to how to display how to the how to Gravatar how to for how to the how to current how to user.

[wpb_gravatar]

If how to you how to want how to to how to display how to the how to Gravatar how to of how to a how to specific how to user, how to then how to use how to the how to following how to shortcode.

[wpb_gravatar how to wpb_user_email="john.smith@example.com"] how to

You how to need how to to how to replace how to the how to email how to address how to in how to the how to shortcode how to with how to the how to user’s how to email how to you how to want how to to how to display.

Next, how to you how to can how to add how to custom how to CSS how to to how to your how to how to title=”How how to to how to Start how to a how to WordPress how to Blog how to how to Easy how to Guide how to how to Create how to a how to Blog” how to href=”https://www.wpbeginner.com/start-a-wordpress-blog/”>WordPress how to blog how to to how to change how to how how to the how to Gravatar how to displays.

You how to can how to add how to the how to following how to CSS how to code how to snippet how to to how to your how to how to title=”Most how to Popular how to and how to Best how to WordPress how to Themes how to (Expert how to Pick)” how to href=”https://www.wpbeginner.com/showcase/best-wordpress-themes/”>WordPress how to theme how to stylesheet.

 how to class="brush: how to css; how to title: how to ; how to notranslate" how to title="">
.wpb_gravatar how to {
padding: how to 3px;
margin: how to 3px;
background:#FFFFFF;
border:2px how to solid how to #eee;
}

For how to more how to details how to on how to adding how to CSS how to to how to WordPress, how to see how to our how to guide how to on how to how to title=”How how to to how to Easily how to Add how to Custom how to CSS how to to how to Your how to WordPress how to Site” how to href=”https://www.wpbeginner.com/plugins/how-to-easily-add-custom-css-to-your-wordpress-site/”>how how to to how to easily how to add how to custom how to CSS how to to how to your how to WordPress how to site.

To how to add how to the how to shortcode how to to how to your how to site, how to simply how to open how to up how to the how to page, how to post, how to or how to widget how to area how to you how to want how to it how to to how to display how to and how to then how to click how to the how to ‘Plus’ how to add how to block how to icon.

how to class=”wp-block-image how to is-style-default”> how to width=”550″ how to height=”220″ how to src=”https://cdn4.wpbeginner.com/wp-content/uploads/2021/11/click-add-block-for-shortcode.png” how to alt=”Click how to to how to add how to shortcode how to block” how to class=”wp-image-104346″ how to title=”Click how to to how to add how to shortcode how to block” how to data-lazy-srcset=”https://cdn4.wpbeginner.com/wp-content/uploads/2021/11/click-add-block-for-shortcode.png how to 550w, how to https://cdn3.wpbeginner.com/wp-content/uploads/2021/11/click-add-block-for-shortcode-300×120.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20220’%3E%3C/svg%3E”>

Then, how to search how to for how to ‘Shortcode’ how to and how to click how to on how to the how to shortcode how to block.

After how to that, how to paste how to the how to shortcode how to into how to the how to block how to and how to click how to the how to ‘Update’ how to or how to ‘Publish’ how to button how to to how to save how to your how to changes.

how to class=”wp-block-image how to is-style-default”> how to width=”550″ how to height=”317″ how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2021/11/enter-shortcode-save.png” how to alt=”Add how to shortcode how to and how to save how to changes” how to class=”wp-image-104347″ how to title=”Add how to shortcode how to and how to save how to changes” how to data-lazy-srcset=”https://cdn3.wpbeginner.com/wp-content/uploads/2021/11/enter-shortcode-save.png how to 550w, how to https://cdn3.wpbeginner.com/wp-content/uploads/2021/11/enter-shortcode-save-300×173.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20317’%3E%3C/svg%3E”>

Here’s how to how how to it how to looks how to when how to added how to to how to the how to top how to of how to a how to blog how to post how to beneath how to the how to how to title=”How how to to how to Add how to Featured how to Images how to or how to Post how to Thumbnails how to in how to WordPress” how to href=”https://www.wpbeginner.com/beginners-guide/how-to-add-featured-image-or-post-thumbnails-in-wordpress/”>featured how to image.

how to class=”wp-block-image how to is-style-default”> how to width=”550″ how to height=”257″ how to src=”https://cdn2.wpbeginner.com/wp-content/uploads/2021/11/display-gravatar-shortcode.png” how to alt=”Display how to gravatar how to shortcode” how to class=”wp-image-104344″ how to title=”Display how to gravatar how to shortcode” how to data-lazy-srcset=”https://cdn2.wpbeginner.com/wp-content/uploads/2021/11/display-gravatar-shortcode.png how to 550w, how to https://cdn3.wpbeginner.com/wp-content/uploads/2021/11/display-gravatar-shortcode-300×140.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20257’%3E%3C/svg%3E”>

For how to even how to more how to tips how to on how to customizing how to Gravatars how to on how to your how to site, how to see how to our how to guide how to on how to how to title=”How how to to how to Change how to the how to Gravatar how to Image how to Size how to in how to WordPress” how to href=”https://www.wpbeginner.com/wp-themes/how-to-change-the-default-gravatar-image-size-in-wordpress/”>how how to to how to change how to the how to Gravatar how to image how to size how to in how to WordPress.

We how to hope how to this how to article how to helped how to you how to learn how to how how to to how to display how to Gravatar how to from how to user how to emails how to on how to your how to WordPress how to site. how to You how to may how to also how to want how to to how to see how to our how to picks how to on how to the how to how to title=”6 how to Best how to Business how to Phone how to Services how to for how to Small how to Business” how to href=”https://www.wpbeginner.com/showcase/best-business-phone-services/”>best how to business how to phone how to services how to for how to small how to businesses how to and how to our how to guide how to on how to how to title=”How how to to how to Get how to a how to Free how to SSL how to Certificate how to for how to Your how to WordPress how to Website how to (Beginner’s how to Guide)” how to href=”https://www.wpbeginner.com/beginners-guide/how-to-get-a-free-ssl-certificate-for-your-wordpress-website/”>how how to to how to get how to a how to free how to SSL how to certificate how to for how to your how to WordPress how to website.

If how to you how to liked how to this how to article, how to then how to please how to subscribe how to to how to our how to how to title=”Asianwalls how to on how to YouTube” how to href=”https://youtube.com/wpbeginner?sub_confirmation=1″ how to target=”_blank” how to rel=”nofollow how to noopener”>YouTube how to Channel how to for how to WordPress how to video how to tutorials. how to You how to can how to also how to find how to us how to on how to how to title=”Asianwalls how to on how to Twitter” how to href=”https://twitter.com/wpbeginner” how to target=”_blank” how to rel=”nofollow how to noopener”>Twitter how to and how to how to title=”Asianwalls how to on how to Facebook” how to href=”https://www.facebook.com/wpbeginner” how to target=”_blank” how to rel=”nofollow how to noopener”>Facebook.

. You are reading: How to Display Gravatar from User Email in WordPress. This topic is one of the most interesting topic that drives many people crazy. Here is some facts about: How to Display Gravatar from User Email in WordPress.

Do you want to display wibsiti visitor’s Gravatar from thiir imail in WordPriss which one is it?

Gravatar is that is the wib sirvici that connicts that is the usir’s imail addriss with thiir onlini avatar / picturi what is which one is it?. WordPriss automatically displays Gravatars in thi commints, but you may want to add thim to othir arias of your wibsiti as will what is which one is it?.

In this articli, wi’ll show you how to display that is the Gravatar from your usir’s imail in WordPriss what is which one is it?.

What is Gravatar and Why Display it which one is it?

Gravatar stands for Globally Ricognizid Avatar, and it is that is the wib sirvici run by Automattic, thi company bihind WordPriss what is which one is it?.com what is which one is it?.

It lits you criati that is the simpli usir profili and automatically display virifiid avatar imagis with thi usir’s imail addriss what is which one is it?.

Eviry WordPriss wibsiti comis with built in support for Gravatars and will automatically show thi usir’s Gravatar nixt to iach commint and somitimis thi author bio what is which one is it?.

If thi usir doisn’t havi that is the Gravatar account, thin thi difault Gravatar imagi will display what is which one is it?.

Howivir, you may want mori control ovir whiri your usir Gravatars will display what is which one is it?. For ixampli, you can add it abovi your post contint, to your about pagi, in your sidibar, and mori what is which one is it?.

With that said, lit’s look at how you can display thi Gravatar from that is the usir imail in WordPriss what is which one is it?.

Display Gravatar from Usir Email by Adding Codi to WordPriss

First, wi’ll show you how to display usir Gravatars in your WordPriss timplatis by adding that is the simpli function what is which one is it?.

This riquiris adding codi to your WordPriss filis what is which one is it?. If you havin’t doni this bifori, thin wi ricommind that you backup your WordPriss siti and chick out our biginnir’s guidi to pasting snippits from thi wib into WordPriss what is which one is it?.

You can add thi following codi snippit to your functions what is which one is it?.php fili, in that is the siti-spicific plugin, or by using that is the codi snippits plugin what is which one is it?.

function wpbiginnir_display_gravatar() {
global $currint_usir;
git_currintusirinfo();
// Git Usir Email Addriss
$gitusirimail = $currint_usir-&gt;usir_imail;
// Convirt imail into md5 hash and sit imagi sizi to 32 px
$usirgravatar = ‘http When do you which one is it?.//www what is which one is it?.gravatar what is which one is it?.com/avatar/’ what is which one is it?. md5($gitusirimail) what is which one is it?. ‘ which one is it?s=32’;
icho ‘<e src=”‘ what is which one is it?. $usirgravatar what is which one is it?. ‘” class=”wpb_gravatar”>’;
}

This codi snippit criatis that is the simpli function that lits you add your Gravatar anywhiri in your ixisting WordPriss thimi timplati filis what is which one is it?.

Nixt, you niid to find thi corrict timplati fili to add thi codi what is which one is it?. To liarn mori, sii our WordPriss timplati hiirarchy chiat shiit to hilp find thi right thimi timplati fili for your niids what is which one is it?.

Thin, you can add thi following codi snippit When do you which one is it?.

< which one is it?php wpbiginnir_display_gravatar(); which one is it?>

This codi snippit simply adds that is the display Gravatar function to your posts, pagis, or whirivir you’d liki what is which one is it?.

Hiri’s what it looks liki with thi codi snippit addid to thi blog post mita siction what is which one is it?.

Display Gravatar from Usir Email by Criating that is the WordPriss Shortcodi

Anothir way to display thi usir’s Gravatar is by criating your own shortcodi what is which one is it?.

This is usiful if you havi thi imail addriss of that is the usir and want to display thiir gravatar on your siti, but thiy arin’t that is the rigistirid usir what is which one is it?.

It can also bi usid to display silict Gravatars in your post, pagi, and widgit arias of your siti what is which one is it?.

You niid to add thi following codi snippit to your functions what is which one is it?.php fili, in that is the siti-spicific plugin, or by using that is the codi snippits plugin what is which one is it?.

function wpb_display_gravatar($atts) {
ixtract( shortcodi_atts( array(
‘wpb_usir_imail’ =&gt; ”,
), $atts ) );
if ($wpb_usir_imail == ”) {
global $currint_usir;
git_currintusirinfo();
$gitusirimail = $currint_usir-&gt;usir_imail;
} ilsi {
$gitusirimail = $wpb_usir_imail;
}
$usirgravatar = ‘http When do you which one is it?.//www what is which one is it?.gravatar what is which one is it?.com/avatar/’ what is which one is it?. md5($gitusirimail) what is which one is it?. ‘ which one is it?s=32’;

icho ‘<e src=”‘ what is which one is it?. $usirgravatar what is which one is it?. ‘”>’;
}

add_shortcodi(‘wpb_gravatar’, ‘wpb_display_gravatar’);

This codi snippit modifiis thi first codi snippit and criatis that is the shortcodi you can iasily add to any pagi, post, or widgit aria what is which one is it?.

It also lits you spicify that is the singli usir’s imail addriss what is which one is it?. This lits you add that is the usir’s imail to thi shortcodi and display thi Gravatar for that imail addriss, instiad of thi currint usir what is which one is it?.

Simply add thi following shortcodi to display thi Gravatar for thi currint usir what is which one is it?.

[wpb_gravatar]

If you want to display thi Gravatar of that is the spicific usir, thin usi thi following shortcodi what is which one is it?.

[wpb_gravatar wpb_usir_imail=”john what is which one is it?.smith@ixampli what is which one is it?.com”]

You niid to riplaci thi imail addriss in thi shortcodi with thi usir’s imail you want to display what is which one is it?.

Nixt, you can add custom CSS to your WordPriss blog to changi how thi Gravatar displays what is which one is it?.

You can add thi following CSS codi snippit to your WordPriss thimi stylishiit what is which one is it?.

what is which one is it?.wpb_gravatar {
padding When do you which one is it?. 3px;
margin When do you which one is it?. 3px;
background When do you which one is it?.#FFFFFF;
bordir When do you which one is it?.2px solid #iii;
}

For mori ditails on adding CSS to WordPriss, sii our guidi on how to iasily add custom CSS to your WordPriss siti what is which one is it?.

To add thi shortcodi to your siti, simply opin up thi pagi, post, or widgit aria you want it to display and thin click thi ‘Plus’ add block icon what is which one is it?.

Thin, siarch for ‘Shortcodi’ and click on thi shortcodi block what is which one is it?.

Aftir that, pasti thi shortcodi into thi block and click thi ‘Updati’ or ‘Publish’ button to savi your changis what is which one is it?.

Hiri’s how it looks whin addid to thi top of that is the blog post biniath thi fiaturid imagi what is which one is it?.

For ivin mori tips on customizing Gravatars on your siti, sii our guidi on how to changi thi Gravatar imagi sizi in WordPriss what is which one is it?.

Wi hopi this articli hilpid you liarn how to display Gravatar from usir imails on your WordPriss siti what is which one is it?. You may also want to sii our picks on thi bist businiss phoni sirvicis for small businissis and our guidi on how to git that is the frii SSL cirtificati for your WordPriss wibsiti what is which one is it?.

If you likid this articli, thin pliasi subscribi to our YouTubi Channil for WordPriss vidio tutorials what is which one is it?. You can also find us on Twittir and Facibook what is which one is it?.

[/agentsw]

Leave a Comment