Support » Fixing WordPress » Add a customized default avatar… php function won't work

  • Hi, I’ve looked online and found a way to add a default avatar into wordpress. I’ve followed what was described and have been trying for a while now, but nothing seems to work, so I’m asking for a little help.

    For info, I’m using the catch-box theme.
    So here’s what I did :

    1) created a 90×90 pixels jpg file
    2) saved the image in ‘wp-content/themes/catch-box/images’
    3) opened functions.php (in catch-box folder)
    4) pasted the code I found, somewhere in the file :

    add_filter( ‘avatar_defaults’, ‘newgravatar’ );

    function newgravatar ($avatar_defaults) {
    $myavatar = get_bloginfo(‘template_directory’) . ‘/images/my_image.jpg’;
    $avatar_defaults[$myavatar] = “My Image”;
    return $avatar_defaults;

    — it is now half-working. Meaning I see the name for my new avatar, but in the Settings, I see a blue square with a question mark, instead of my image!

    So, my questions are:

    1) Is the code correct? What else could I try?
    2) Where exactly in functions.php should the lines of code be saved?
    (without messing things up ; ))
    3) If I repeat the code, could I technically add a 2nd new default avatar?

    4) My blank avatar in Settings is now showing a “question mark” in a blue square (?) as well / It used to show a “white square”.
    Why is that? And could it be linked to my problem?

    THANK YOU very very much for your help..
    I’m usually very motivated to find things on my own.. and I eventually succeed ! But this time, I’m stuck.


    Note: I can’t share my url yet, as I am working locally using MAMP.

Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Add a customized default avatar… php function won't work’ is closed to new replies.