How to Set the Gravatar Size in WordPress

How to Set the Gravatar Size in WordPress thumbnail
Set the size of Gravatars in the "get_avatar()" function.

WordPress uses Gravatars -- Globally Recognized Avatars -- to display avatars on comments templates. Not all themes (what WordPress calls its templates) include a comments template, but if a given theme does, you can go in through the dashboard and edit the Gravatar size. The function that adds Gravatars uses a size parameter that is very straightforward. Its output gives the avatar an equal width and height. You can use any size you like, but check to make sure that your new size does not "break" the website layout.

Instructions

    • 1

      Log into the WordPress dashboard and then navigate to "Appearance." Click on the "Editor" link under "Appearance" to load the theme editing screen. Find the "comments.php" file for your theme in the right-hand list and then click on its link to load it in the editing box.

    • 2

      Find the get_avatar() function in the code of your comments template. This function usually exists between the opening and closing <li> tags of the template because each comment gets printed out as an item in a numbered list.

    • 3

      Add or change the size parameter within the get_avatar() function. Here is an example:

      <?php echo get_avatar($id_or_email, $size = '64'); ?>

      This function requires "id_or_email," but size is optional. Use multiples of eight for the best sizes, such as 16-pixels or 32-pixels.

    • 4

      Click the blue "Save" button and then reload your website in the browser. Check that the new size fits with your design and make edits as needed.

Tips & Warnings

  • Back up your theme files before editing them. Mistakes in PHP files can lead to white screens where you cannot log back into WordPress. Re-upload the original files via FTP to get back into your dashboard.

Related Searches:

Resources

  • Photo Credit Burke/Triolo Productions/Brand X Pictures/Getty Images

Comments

You May Also Like

Related Ads

Featured