• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Replacing call to gravatar for authorbox with locally hosted image?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Replacing call to gravatar for authorbox with locally hosted image?

This topic is: not resolved

Tagged: Author, gravatar

  • This topic has 5 replies, 2 voices, and was last updated 7 years, 6 months ago by lvvvvvl.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • July 8, 2015 at 4:28 am #158764
    lvvvvvl
    Participant

    Hello,

    I noticed in my current child theme the author box calls to gravatar in order to get the author image which significantly reduces load time by a second or two (depending on their servers).

    Is it possible to make the author image locally hosted rather than requiring gravatar?

    Thank you!

    July 8, 2015 at 4:37 pm #158843
    Tom
    Participant

    This plugin should do what you want:
    https://wordpress.org/plugins/wp-user-avatar/


    Choose your next site design from over 350 Genesis themes.
    [ Follow me: Twitter ] [ Follow Themes: Twitter ] [ My Favourite Webhost ]

    July 8, 2015 at 7:02 pm #158856
    lvvvvvl
    Participant

    Thanks Tom, I stumbled upon that in my searches but I thought perhaps there might be a more elegant solution to increase site performance than adding another plugin.

    I imagine that's the advantage of Genesis, its customization. I found this tutorial on how to add social buttons which requires unhooking the author box and creating your own custom version (https://wpbeaches.com/author-box-genesis/) but I don't have the knowledge to figure out how to replace the gravatar call with a locally hosted image that could be linked from one of the author fields.

    July 9, 2015 at 12:02 am #158870
    lvvvvvl
    Participant

    I've tried writing up a code that would simply replace the functionality of get_avatar but it's creating some sort of error in my admin panel in which it loads the left side menu but all the content of the admin pages simply displays the blank background.

    This is the code which I'm using and pasting the author avatar image url in their 'yim' profile section:

    //* Local Author Gravatars *// 
    add_filter('get_avatar', 'get_no_gravatar', 1, 2);
    function get_no_gravatar( $id_or_email, $size = '180', $default = '', $alt = false ) {
       // put your new function in here
            $avatar = '<img alt="'.get_the_author_meta('display_name').' Avatar" src="'.get_the_author_meta('yim').'" class="avatar avatar-{$size} photo avatar-default" height="{$size}" width="{$size}" />';
    	return apply_filters('get_avatar', $avatar, $id_or_email, $size, $default, $alt);
    };

    Any ideas what I'm doing wrong?

    July 9, 2015 at 1:23 pm #158947
    Tom
    Participant

    Bill Erickson has as solution from 2011 that works well. I just tried it in Eleven40 Pro. If your theme uses genesis_author_box_gravatar_sizeyou can easily make adjustments.

    http://www.billerickson.net/wordpress-custom-avatar/


    Choose your next site design from over 350 Genesis themes.
    [ Follow me: Twitter ] [ Follow Themes: Twitter ] [ My Favourite Webhost ]

    July 10, 2015 at 2:21 am #158998
    lvvvvvl
    Participant

    Thanks Tom, that worked beautifully and just what I wanted!

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble