WordPress plugin intelligence profile

Post Avatar

Choose an avatar from a pre-defined list to include in a post.

WP PlugIndex snapshot

Current directory snapshot

Tested up to WordPress 4.9
Current version1.6.0
WordPress coverageTested up to WordPress 4.9
Minimum stackWP 3.9 · PHP 5.6.3
Directory statusactive
Last directory update23 Aug 20188y ago
Active installations100Adoption metric — not a quality score
WordPress.org rating5.0 / 5 from 1 ratings
Official packageDirect from WordPress.org

Repository metrics are context, not quality scores. Active installations measure adoption and can strongly reflect a plugin’s age and historical popularity. Ratings, recent updates and “Tested up to” metadata also do not guarantee modern code, error-free operation, security, feature completeness or suitability for a particular site. Why active installs don’t tell the whole story →

WP PlugIndex currently records Post Avatar version 1.6.0 as active, updated 8y ago and tested up to WordPress 4.9.

Overview

About this plugin

Allow authors to select an image from a pre-defined list while in the Post Editor screen. This image will be displayed together with a post.

Post Avatar is similar in concept to Livejournal userpics wherein authors choose images uploaded by the site owner. Developed with Dominik Menke.

Features

  • Easy selection of images from within the Post Editor screen.
  • Scans images in sub-directories of the image option folder.
  • Allows the following file types:.jpg,.jpeg,.gif and.png.
  • Flexible with customizing avatar display.
  • Display avatars using the default HTML/CSS tags.
  • HTML/CSS tags can be edited from with the Settings screen.
  • Use template tags and custom filters within themes for advanced customization.
  • International language support for Belorussian, Czech, Dutch, French, German, Hindi, Irish, Italian, Polish, Romanian, Serbo-Croatian, Spanish
  • Does not display missing images.
  • Can be further extended to show images for pages and custom post types

Bug Submission and Forum Support

WordPress Forum

Post Avatar home page

Please Vote and Review

Your votes and feedback are greatly appreciated. Thanks.

Advanced Customization

For Front End Display

By default, the plugin hooks into the following filters: the_content() and the_excerpt().

OVERRIDE HTML DISPLAY USING FILTER HOOK: gklpa_the_postavatar

The gklpa_the_postavatar filter takes two parameters:

-

$post_avatar_text – Original HTML display

-

$post_avatar – Post Avatar data in array format. The keys are:

avatar_url: The URL to the image show_image_dim: 1 indicates to show image dimensions, 0 to hide them image_height: integer value of image height or null if image dimensions is turned off image_width: integer value of image width or null if image dimensions is turned off post_id: ID of current post post_title: Post title for the image attribute image_name: Image file name

Example: Display a default image if no avatar is selected

This example makes use of the HTML/CSS settings defined by the site admin.

add_filter( 'gklpa_the_postavatar', 'prefix_show_default_image', 10, 2 ); function prefix_show_default_image( $post_avatar_html, $post_avatar_array ){ global $post, $gklpa_plugin_settings;

empty( $gklpa_plugin_settings['css_class'] ) { $css = 'class="'. $gkl_plugin_settings['css_class']. '"'; } $post_avatar_html = $gklpa_plugin_settings['html_before' ].

'<img '. $css. jpg" alt="'.

esc_attr(strip_tags($post->post_title) ). '" />'. $gklpa_plugin_settings['html_after']; } return $post_avatar_html; }

OVERRIDE HTML DISPLAY WITH CUSTOM CONTENT HOOK

If you want to change the HTML completely or override the option to display avatars automatically, use the remove_filter() like so:

remove_filter(‘the_content’, ‘gkl_postavatar_filter’, 99 );

remove_filter(‘the_excerpt’, ‘gkl_postavatar_filter’, 99 );

You can then define your own the_content filter function that makes use of the gkl_postavatar() or gkl_get_postavatar() functions

You will need to use the function gkl_get_postavatar() which takes the post object and returns the array of post avatar information.

-

$post_avatar_array – Post Avatar data in array format. The keys are:

avatar_url: The URL to the image

show_image_dim: 1 indicates to show image dimensions, 0 to hide them

image_height: integer value of image height or null if image dimensions is turned off

image_width: integer value of image width or null if image dimensions is turned off

post_id: ID of current post

post_title: Post title for the image attribute

image_name: Image file name

Example:

add_filter( 'the_content', 'my_custom_post_avatar' ); function my_custom_post_avatar( $content ){ global $post;

jpg'; $alt_text = esc_attr(strip_tags($post->post_title) ); } else { $image_url = $current_avatar['avatar_url']; $alt_text = $current_avatar['post_title']; } $post_avatar_html = $html_before. '<img src="'. $image_url.

'" alt="'. $alt_text. '" />'.

$html_after;

return $post_avatar_html; }

OVERRIDE HTML DISPLAY WITH template tag gkl_postavatar

g. with the entry’s meta information, make use of the gkl_postavatar() template tag.

It takes four paramters:

class: CSS class to use in the `<img>` tag. before: HTML to appear before the image. after: HTML to appear after the image.

do_what: Use `echo` to display the post avatar, `return` to pass it to a variable. Defaults to `echo`.

Example: In a template file:

>

-- more template tags here -- </div>

Or you can make your own template tag function like in the example for “Override HTML display with custom content hook”, except you call the function directly in your template instead of hooking into the_content().

For Administration Screens

Add Post Avatar to Pages and Custom Post Types

Use the filter hook gklpa_allowed_post_types to add further post types that you want the Post Avatar selection to appear on.

It takes an array of post type slugs as a parameter.

add_filter( 'gklpa_allowed_post_types', 'prefix_my_custom_post_types' ); function prefix_my_custom_post_types( $current_post_types ){ $current_post_types = array( 'post', 'page', 'review', 'event' ); return $current_post_types; }

Enable Image Selection for Folder Outside of WordPress Installation

By default, Post Avatar looks for your images folder in relation to your WordPress installation. If you want to move your folder elsewhere, use these pair of filter hooks: gklpa_image_url and gklpa_image_dir. They take a single parameter: Image folder url and absolute path to the image folder, respectively.

com/images/' ); }

add_filter( 'gklpa_image_dir', 'prefix_change_folder_dir' ); function prefix_change_folder_dir ){ return '/user/public_html/images/'; }

Please visit the Post Avatar Page for details on customizing the avatar display.

Translations

Post Avatar is translation-ready and supports a number of languages. If you can’t find your language here, please consider contributing a language pack.

If you’re interested, please check out the “Codestyling Localization” plugin and for validating the “Poedit Editor”.

com

Thanks to the following for their language packs.

  • Belorussian (ru_RU) Fat Cower
  • Czech (cz_CZ) Lelkoun
  • Dutch (nl_NL) Jay August
  • French (fr_FR) Mathieu Haratyk
  • German (de_DE) Dominik Menke
  • Hindi (hi_IN_Hindi) Outshine Solutions
  • Irish (ga_IR) Ray S.
  • Italian (it_IT) Gianni Diurno
  • Polish (pl_PL) Meloniq
  • Romanian (ro_RO) Webhosting Geeks
  • Serbo-Croatian (sr_RS) Webhosting Hub
  • Spanish (es_ES) gogollack
WordPress.org metadata

Plugin tags

Topics listed for this plugin in the WordPress.org directory.

  • avatars
  • image
  • images
  • post
  • thumbnail
Compatibility & maintenance

Compatibility & maintenance

Tested up to WordPress 4.9

Not yet marked as tested with WordPress 7.1. WordPress.org currently lists Tested up to 4.9.

Current WordPress releaseWordPress 7.1
WordPress.org Tested up to4.9
Minimum requirementsWordPress 3.9 · PHP 5.6.3
Update activity23 Aug 20188y ago

“Tested up to” is directory metadata supplied by the plugin author. WP PlugIndex does not turn an older declaration into a claim that the plugin is incompatible.

Changes recorded by WP PlugIndex

Recent tracked changes

No tracked version or compatibility changes have been recorded by WP PlugIndex yet.

Tracking & source

WP PlugIndex tracks public WordPress.org directory metadata and records selected version, compatibility and availability changes as they are detected.

Plugin watchlist

Watch this plugin

Sign in to your WP PlugIndex account or create a free account. Free accounts can watch up to 5 plugins and see what changed.

Watch limit

Watchlist limit reached

You have reached your current active watch limit.