• Resolved Elecdancegen

    (@elecdancegen)


    Hello, I was wondering if anyone could help me with trying to upload custome gravatar .pngs. I try to add the code below to functions.php below, but when I save it through FTP it causes the site to go down/be unavailable.

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Note: that is the default unedited code. I try to edit the template directory from the root source to the theme name. I don’t test this on my actual site, but a test domain site in case things like this happen. This code apparently will let me use multiple gravatars I made like the generated default ones. So again, when I try to edit the code and save it, the site goes down. What is wrong? Can anyone help me? Thanks in advance if you can.

    P.S., I’m a noob at web design right now, but learning much as time goes by.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The code you posted works fine. I just tested it on a local dev site I have, and it worked fine, no issues. So the error has to be coming from something else.

    Thread Starter Elecdancegen

    (@elecdancegen)

    I got the gravatar icons to show up just now in the wordpress discussion page. The problem is that they show as the default gravatars when I set their paths for my own pngs.

    Here’s how I set each additional gravatar code up

    // add a custom user gravatar
    	$customGravatar2 = get_bloginfo('/wp-content/themes/graphene').'/images/edg gravatar blue.png';
    	$avatar_defaults[$customGravatar2] = 'EDG box blue';

    So if that is all correctly entered then I can only assume a preexisting line of code conflicts with what I am trying to do. This may be too advanced for me or either I’m seriously overlooking something.

    Thank you for trying out the code dkotter, I appreciate the reply.

    Not sure if this is the issue, but you have some issues in the code you posted. You should use the same code you had before, for the argument that goes in to get_bloginfo(). In the above code you are passing in a file directory, but get_bloginfo() doesn’t accept that as an argument, as far as I know.

    $customGravatar2 = get_bloginfo('template_directory') . '/images/avatar.gif';

    That’s what should be in get_bloginfo(), which should return the same thing you hard coded in there.

    Second your image file has spaces in the name, which might be messing it up. File names shouldn’t have any spaces, so that will need to be renamed either with no spaces are replace the spaces with – or _.

    Hopefully that fixes the issues.

    Thread Starter Elecdancegen

    (@elecdancegen)

    Thank you dkotter, it worked! The main thing was the ‘template_directory’, for some reason I thought I was supposed to paste the directory to the theme in that section.

    Cheers!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Editing functions.php for custom gravatars doesn't work’ is closed to new replies.