Post Avatar

A WordPress plugin simplifies the process of including a picture when writing posts. Authors simply choose from a predefined list of images in the Write Post page to display an image in a post. A template tag displays the image with The Loop. This plugin is similar to Livejournal userpics.

Authors: Vicky Arulsingam and Dominik Menke
Current Version: 1.6.0 (updated: March 31, 2015)
Download: post-avatar.zip
Support: via WordPress Forums || Support Page


Features
Installation
Configuration
Usage
Translations
Donate
Version History (Changelog)
Known Issues

Post Avatar was a finalist at The 2007 Philippine Blog Awards for Best Plugin/Extension.

Features

  1. Easy selection of images in the Write Post screen.
  2. Scans images in sub-directories of the image option folder.
  3. Allows the following file types: .jpg, .jpeg, .gif and .png.
  4. Show avatar automatically in blog or use a template tag to display in themes.
  5. Does not display missing images.

Back to Top

Installation

Manual Installation

  1. After downloading the zip file from WordPress.org, extract the zip file onto your computer. This will create a folder `post-avatar` containing the plugin files.
  2. Connect to your webserver and upload the `post-avatar` folder to where your plugins are installed, typically, `/wp-content/plugins`.
  3. To activate the plugin go to the Plugins menu in your WordPress installation’s admin area. Click “Activate” for the “Post Avatar” plugin

Automatic Installation

  1. From the Plugins menu, click Add New and search for Post Avatar
  2. Click “Install Now” so that WordPress will download and install the plugin
  3. Once the installation is complete, you will be asked to click “Activate Plugin

See Also: The WP Codex has more information about installing plugins

Configuration

The plugin sets default options during the activation process. To change these settings go to the Settings menu in your WordPress installation’s admin area. Choose the Post Avatar link.

  • Path to Images Folder – location of your images folder in relation to your WordPress installation.
  • Show avatar in post? Disable to use template tag. – A tick mark here will display the avatar on your site. If you want to customize the avatar HTML, un-tick this setting and use the template tag gkl_postavatar() or custom filters.
  • Scan the images directory and its sub-directories – Tick this to include images stored in sub-directories of the images folder in the avatar selection.
  • Get image dimensions? Disable this feature if you encounter getimagesize errors – Turned on by default, a tick mark here will determine the image’s width and height. If you encounter any getimagesize errors, turn this feature off.
  • Show post avatars in RSS feeds? – Turned off by default, place a tick mark here to include avatars in your RSS feeds.

These options help you further customize the display of your post avatar

  • Before and After HTML – enter the HTML you want to display before and after the post avatar.
    Example: Before: <div class=”myimage”> / After: </div>
    Output: <div class=”myimage”><img src=”http://wplatest.dev/icons/image.jpg” alt=”post-title” /></div>

  • CSS Class – enter the name of the css class that you would like to associate with the post avatar image. Can be left blank.
    Example: The class name is: postimage
    Output: <img class=”postimage” src=”http://wplatest.dev/icons/image.jpg” alt=”post-title” />

    If you use both the css class and the before and after html you will get the following output:
    <div class=”myimage”><img class=”postimage” src=”http://wplatest.dev/icons/image.jpg” alt=”post-title” /></div>

Back to Top

59 thoughts on “Post Avatar

  1. Hello, thank you for your plugins, good job!
    I have some thoughts,
    1 When user deactivate this plugin, it would be better that the plugin uninstall itself, including the variables in database table.
    2 When read/write variables from/into database, using addslashes/stripslashes can make the display correctly, especially the gklpa_before and gklpa_after variables.
    Thank you!

    • Hi rorocket,

      I’m planning on including a delete option when the user deactivates the plugin. That way they can choose to delete all the options when deactivating/uninstalling the plugin.

      Regarding request number 2, can you give me an example of HTML that isn’t being displayed properly?

      • Thank you for your reply!
        Last week, I transfer my wordpress data from one mysql to another, the gklpa_after variable are changed from to </div>, the same change with gklpa_before. Therefore, the page display strangely.
        I active and deactive Post Avatar many times, but it doesn’t work.
        I think it would be better to provide a button “Restore Factory Defaults”, it can change the decoded string back to the correct one.

  2. I’ve just installed your plugin on a new version of WP. I have it on an old version (2.4ish) and it works fabulously, I love it. I wanted to incorporate it on the new blog, but though I’ve added the icons folder and the path under Settings is correct, the dropdown to choose an avatar is empty. I’ve checked everything I know (which is not much, haha!) and don’t know what to try next. Any help is appreciated!

    • I fixed it! A silly oversight. Anyhow, thank you again for the plugin! I can now say it works fabulously on BOTH my blogs, haha… :)

  3. Thanks so much for this plugin.

    I was wondering if there was any way to have the image be displayed as the background to a table cell in html? I am having a hard time trying to figure this out.

    Thanks!!

    • I figured it out. I just want to thank you for writing the plugin so neatly.

      If anyone is wondering how to do it, I basically created the table within the plugin to assign the image as the background, and then closed the table outside the plugin. This allows the user to put dynamic text over the image. I’m not sure if this is proper practice… but it works.

      replace: ‘$post_avatar_text = $before .”. $after .”\n”;’

      with: ‘$post_avatar_text = $before .”.$after;’

      in index.php: text here

  4. Pingback: Post Avatar | CompareWordPressPlugins

  5. Fatal error: Maximum execution time of 20 seconds exceeded in /wp-content/plugins/post-avatar/gkl-postavatar.php on line 173
    …?

    • In that line of code the plugin is checking to see if the item in the directory you specified is a folder.
      Do you have a lot of images in that folder?
      If so, it’s because you’ve set the maximum execution time too low. You can increase it by adding this to your .htaccess
      php_value max_execution_time 200

  6. Pingback: 25 Useful Free WordPress Plugins For Multi-Author Blogs – Just a blog :)

  7. My code didn’t copy properly:
    if ( ! function_exists( ‘twentyeleven_posted_on’ ) ) :
    function twentyeleven_posted_on() {
    printf( __( ‘ %4$s by %7$s‘, ‘twentyeleven’ ),
    esc_url( get_permalink() ),
    esc_attr( get_the_time() ),
    esc_attr( get_the_date( ‘c’ ) ),
    esc_html( get_the_date() ),
    esc_url( get_author_posts_url( get_the_author_meta( ‘ID’ ) ) ),
    sprintf( esc_attr__( ‘View all posts by %s’, ‘twentyeleven’ ), get_the_author() ),
    esc_html( get_the_author() )
    );
    }
    endif;

  8. I’m having a hard time getting the avatar to appear next to the author’s name. I’ve added to functions.php (“pavatar” is what I named the div in the backend as well) but don’t know how to add the function. I tried adding the code you have in “usage” but I keep getting TSTRING errors.

    I’m trying to get it in to here:
    if ( ! function_exists( ‘twentyeleven_posted_on’ ) ) :
    function twentyeleven_posted_on() {
    printf( __( ‘ %4$s by

    %7$s‘, ‘twentyeleven’ ),
    esc_url( get_permalink() ),
    esc_attr( get_the_time() ),
    esc_attr( get_the_date( ‘c’ ) ),
    esc_html( get_the_date() ),
    esc_url( get_author_posts_url( get_the_author_meta( ‘ID’ ) ) ),
    sprintf( esc_attr__( ‘View all posts by %s’, ‘twentyeleven’ ), get_the_author() ),
    esc_html( get_the_author() )
    );
    }
    endif;

    Thanks so much!!

  9. Pingback: Powered By …

  10. Pingback: 7Maximes-News For Designers & Web Developers

  11. Pingback: Sacima鲨鳍马工作室 » Blog Archive » 25 Useful Free WordPress Plugins For Multi-Author Blogs

  12. Pingback: 25 Useful Free WordPress Plugins For Multi-Author Blogs

  13. How do you set it so the avatar will align with the subject/date? Right now I have it so the actual content of the post will align with the avatar. So using an example from below, it’s something like this at the moment:

    | Subject
    | Date
    | AVATAR text text text text text text text text text text text text text text text text text text text text text text text text text text text

    When I want:
    | AVATAR Subject
    | ” ” Date
    | ” ” text text text text text text text text text text text text text text text text text text text text text text text text text

    Is there somewhere I can set this within the plugin files, or is related to something else?

  14. Nice plugin. It was working fine for a long time until suddenly, the list of avatars is not showing when editing a post. I click on the dropdown list, and it’s blank. The settings and directories are all the same, I checked via FTP and the folder is still there, with all the images. Any idea what’s causing this and how to correct it? Thank you.

    • Ok, solved this. I had the full url in the “Path to Images Folder” blank, instead of just the path in relation to my installation. But what’s weird is, I don’t remember changing it, I think that was working before. Anyway, it’s working now. Thanks.

    • Ok, I see in the .css file where to change the position of the avatar (right or left), but I’m still curious if it’s possible to place it online with the post title? Thank you.

      • The automatic display option includes the post avatar image with the post content. So the most you can do is change your styling to move it around. If you want to place with the post title, you will have to disable the automatic display or use this code inside the “functions.php” file of your theme:
        remove_filter( 'the_content', 'gkl_postavatar_filter', 99 );

        Then inside your template files locate where you’ve placed “the_title” and include the post avatar like so:
        <?php gkl_postavatar('postavatar', ' ', ' '); ?><php the_title(); ?>

        Please see “Using the Template Tag ‘gkl_postavatar'” in Usage instructions.

  15. Hi,

    Is there a way to make the list of avatars selectable from each user profile ?
    And not only the author post page ?
    I want to let all users who comment to have their own avatars, not uploaded, but chosen from my list of pictures.

    I know that it might be different from the current function of the plug-in, but is it possible ?

    Thanks

    • The Post Avatar plugin is for posts/pages/custom post types only and isn’t easily ported to work with comments.

      You can try another plugin like: Custom Comment Fields

      I am currently working on a plugin for adding more comment fields but it’s still in the development stage.

      • At the moment I have this on my posts :

        | AVATAR
        |
        | text…text…text…text…text…text…text…text…text…text…

        And I want to have this :

        | AVATAR text…text…text…text…text…text…text…text…text
        | text…text…text…text…text…text…text…text…text
        | text…text…text…text…text…text…text…text…text…text…tex

        I want the first line of my post starts right of the avatar and dress the avatar, instead of starting under the avatar.

        It was possible on the last version, but I dont remember how to do.

        PS : I’m french, and my english is very poor ^^

        • Hmmmm. I think the problem has to do with the default stylesheet not being displayed. I’m going to look into this.

          • You need to go into your CSS file with FTP access.

            Folder Location should look something like this.

            …/wp-content/plugins/post-avatar/head/gkl-postavatar.css

            The CSS should be changed to this:

            .postavatar {
            float:left;
            marign-top: 0px;
            margin-left: 0px;
            margin-bottom: 15px;
            margin-right: 15px;
            }

            .postavatar img {
            float:left;
            marign-top: 0px;
            margin-left: 0px;
            margin-bottom: 15px;
            margin-right: 15px;

          • I just updated my version of WordPress and now the same thing is happening to me. I tried putting this in the settings ..
            but nothing is changed. I’d like the text to wrap around the avatar. Please assist!

  16. On some WP blogs
    “Go to Options » Post Avatar. Set the following options”
    is “Go to Settings » Post Avatar. Set the following options”

    • Thanks for the reminder. “Options” was the menu name in WP2.5 and below. I’ll change the description to reflect the correct path.

  17. Pingback: meloniq Technicznie » Spolszczenie Post Avatar

  18. Pingback: Veränderungen in der Pinguinpost « Relaxecke

  19. Pingback: Must-Have Plugins for Multi-Author WordPress Blogs | MYCOM SHOP

  20. Pingback: Top 10 Favourite WordPress Plugins by a Pregnant Chick — Superstructure

  21. Pingback: Top 10 Wordpresss Plugins | SEO Chicks

  22. Pingback: Wat is, en hoe wijzig ik de standaard avatar in Wordpress 2.5+

  23. Pingback: 10 Must-Have Plugins for Multi-Author WordPress Blogs | Best WordPress Plugins

  24. Pingback: TANEMM.COM » Wordpressカスタマイズの際使用したもの

  25. Pingback: agneson9 » Blog Archive » this is a client test

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>