Plugin Directory


PostIcons adds icons to posts. Can be used with CategoryIcons plugin to display category icons when a post doesn't have an icon asociated with it. I am currently using this plug-in on Web Programming DevCorner.

The plugin has the following features:

  • User can assign or icon to a post by assigning a value to an 'icon' user (meta) post field.
  • By using a ’small_icon’ field, user can assign alternate plugin.
  • A template tag (function) is exposed to include post icon into template. Alternatively if the post doesn’t have icon assigned, category icon may be used.
Compatibility: WP 1.5
License: GPL (free)
Latest Stable Release: 1.0
Plugin Home Page: Post Icons WordPress plugin
Download: Post Icons plugin Download


The plugin exposes the get_post_icon function as a WordPress template tag to be used in WordPress templates. It takes following options, passed in WordPress template tags manner:

  • $fit_width int [-1] Maximum width (or desired width if $expanded=true) of the image.
  • $fit_height int[-1] Macimum height (or desired height if $expanded=true) of the image.
  • $expand boolean [false] Whether the image should be expanded to fit the rectangle specified by fit_xxx.
  • $id int ID of the post. If not specified, use $post parameter or current post if not specified.
  • $post string Post slug of the post. If this is specified and not $id given, it is used to determine the post ID.
  • $small boolean [false] Use the small icon.
  • $prefix string String to echo before the image tag. If no image, no otuput.
  • $suffix string String to echo after the image tag. Ignored if no image found.
  • $class string [] Class attribute for the image tag.
  • $link boolean [true] If true the image is made a hyperlink (wrapped by anchor tag).
  • $use_category boolean [true] If the post doesn’t have an icon, use the category icon.

The function returns boolean value indicating whether the image was found (true if found).


  • If no post is specified, current post is used.
  • If the current post doesn’t have icon, the category icon is used (optional through $use_category).


This example will insert the icon associated with the current post:

<?php get_post_icon(); ?>

This example inserts icon for a post with ID 5. The image is fitted withing rectangle 100×100. If the image is smaller than desired, it is expanded.:

<?php get_post_icon('id=5&fit_width=100&height=100&expand=true'); ?>

The following piece of code will insert the image for a post with post slug ‘post-icon-test’:

<?php get_post_icon('id=post-icon-test'); ?>

Installation Instructions

  1. Copy the post_icons.php file into your wp_content/plugins directory.
  2. Activate the plugin from Plugins admin menu.

This plugin was brought to you by baobab.

Last modified 12 years ago Last modified on 10/29/05 13:37:37