Grow your CSS skills. Land your dream job.

WordPress template

  • # May 21, 2009 at 11:36 am

    Hi there newbie here.

    I only just start using wordpress and learning how to design my own theme from CSS Videos ‘Designing for WordPress’.
    P.S thanks a lot Chris Coyier your the man, there is so much info to gain from your site. But one video at a time :D .

    I have stumbled across a few errors on the third video of ‘Designing for WordPress’. I cant figure out why my gravatar is not working properly. By the way, I am using a virtual host ‘XAMPP’ for installing wordpress. I activated the gravatar plugin but it is not working.

    Here is the error:
    Error

    Quote:
    Fatal error: Call to undefined function gravatar() in C:Program Filesxampphtdocswordpresswp-contentthemesblankcomments.php on line 43

    PHP file: comments.php

    Quote:
    <img src="images/search.jpg" alt="" style="margin-top: -10px;" />

    <img src="<?php gravatar(‘R’, 125, ‘images/gravatar.jpg’); ?>" alt="Gravatar" class="floatleft" />

    Any suggestions what I’m doing wrong here?

    Many thanks in advance
    CHEERS :)

    # May 22, 2009 at 6:52 am

    Damn I must be the only one with this kind of error :shock:

    # May 22, 2009 at 9:20 am

    I’m not sure where you got that code from so it’s difficult to say.

    As of WordPress 2.5 Gravatar support is built-in. The theme function for accessing gravatars is get_avatar(), which returns a complete <img> tag of the avatar.

    Prior to 2.5 support for Gravatar was provided by plugins, so the code you have may require you to install a plugin to work properly.

    # May 22, 2009 at 9:56 am
    "davesgonebananas" wrote:
    I’m not sure where you got that code from so it’s difficult to say.

    As of WordPress 2.5 Gravatar support is built-in. The theme function for accessing gravatars is get_avatar(), which returns a complete <img> tag of the avatar.

    Prior to 2.5 support for Gravatar was provided by plugins, so the code you have may require you to install a plugin to work properly.

    Hi dave,

    Thanks, I’m just happy someone replied back to me :D .

    I actually got this code from Chris Coyier’s video tutorial ‘Design for wordpress’ and followed everything until this minor hiccup.

    Are you able to show me a sample of that script and how it works? Like where do I put

    Quote:
    ‘The theme function for accessing gravatars is get_avatar()’

    code?

    # May 22, 2009 at 10:39 am

    Ok, I have found the tutorial and downloaded the template. The template relies on an old plugin (Gravatar) which has been replaced by the built-in functionality in WordPress now (I think).

    You can update the template by replacing the line in comments.php:

    Code:
    ” alt=”Gravatar” class=”gravatar” />

    with

    Code:
    < ?php echo get_avatar($comment->comment_author_email, 40, “http://css-tricks.com/wp-content/themes/CSS-Tricks/images/missing-gravatar.png”); ?>

    And in style.css change:

    Code:
    .gravatar { margin-top: 3px; padding: 2px; height: 40px; }

    to

    Code:
    .avatar { margin-top: 3px; padding: 2px; height: 40px; }
    # May 22, 2009 at 11:01 am

    Oh my GOD, oh my GOD it worked Dave, it really worked..thank you thank you :D :D ;) .
    Now I understand why it didn’t work in the first place :roll: .

    I have the avatar in place now, so all I have to do is align the comment tip and bubble with the CSS. So hopefully no more dramas with this :mrgreen: .

    Thanks heaps Dave.
    CHEERS :)

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".