WordPress.org

Ready to get started?Download WordPress

Forums

Add Local Avatar
Avatars Usage (1 post)

  1. LaoziSailor
    Member
    Posted 2 years ago #

    I have no PHP experience and hope somebody can give me a hand.

    I tried adding the code (on top of the file)
    "post-template" and it complains about an extra "["
    If I take these out I get different type of problems.

    So in essence these instructions do not help me.
    I need some concrete examples of where to make the changes.
    For the time being I will not touch these although an avatar on the "comment-template" would be nice.

    category-template
    general-template
    template-loader
    nav-menu-template
    author-template
    bookmark-template
    link-template
    post-thumbnail-template
    comment-template
    template

    Avatars Usage

    Put this code in your template files where you want avatars to appear:
    <?php $avtr = get_avatar(id [, size [, default-image-url]]); echo $avtr; ?>

    The function takes the following parameters:

    id: Identifier; required, a blog user ID, an e-mail address, or a comment object from a WordPress comment loop (for comments).
    size: Size (pixels); optional, defaulted to value set above.
    default-image-url: Default image if no Global (public) or Local (private) avatar found; optional, defaulted to value set above.

    Apply format to the avatars with something like the following in your style.css theme file:

    For comment avatars, .avatar { float: left; padding: 2px; margin: 0; border: 1px solid #ddd; background: white; }
    For avatars in post content, .post_avatar { padding: 2px; margin: 0; border: 1px solid #ddd; background: white; }

    Examples for your theme's template files:

    In single.php declare <?php global $post; ?> if not already declared and then use <?php echo get_avatar($post->post_author); ?> to show the post author's avatar.
    Inside the comment loop of comments.php use <?php echo get_avatar($comment); ?> to show the comment author's avatar.

    http://wordpress.org/extend/plugins/add-local-avatar/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic