WordPress plugin intelligence profile

Category Image(s)

Display an image for each category associated with a post.

WP PlugIndex snapshot

Current directory snapshot

Tested up to WordPress 3.4
Current version1.7.3
WordPress coverageTested up to WordPress 3.4
Minimum stackWP 2.2 · PHP —
Directory statusactive
Last directory update11 Jun 201214y ago
Active installations100Adoption metric — not a quality score
WordPress.org rating4.5 / 5 from 2 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 Category Image(s) version 1.7.3 as active, updated 14y ago and tested up to WordPress 3.4.

Overview

About this plugin

Display an image for each category associated with a post.

Notes:

This plugin provides the templates tag c2c_the_category_image() which basically reproduces and extends the functionality of WordPress’s core function the_category() to add the ability to display a category image instead of the category name in the link to the category archive. With its $image_extensions argument defaulted to "", the plugin could be a drop-in replacement for the_category(). As is done in the_category(), the image or text for each category is also a link back to that category’s archive.

Related info about the function:

  • If $image_extensions is defined, but no image is found for the category, then nothing is displayed for that category.
  • $image_extensions can be defined as a space separated list of image extensions. Files will be checked with the image extensions in the order those extensions were provided; default is ‘png gif jpg’.
  • The number of category links/images displayed can be limited via the $limit argument
  • Category image tags are defined with class=”catimage” for stylesheet manipulation.
  • The result can be filtered via the filter named “c2c_the_category_image”.

-

Must be run inside “the loop”.

c2c_get_category_image_list() is another provided function, which is identical to c2c_the_category_image() except that it doesn’t echo the result.

Links: Plugin Homepage | Plugin Directory Page | Author Homepage

Template Tags

The plugin provides one optional template tag for use in your theme templates.

Functions

  • <?php function c2c_the_category_image( $seperator='', $parents='', $image_extensions='png gif jpg', $image_dir='/wp-content/images/', $use_name_if_no_image=false, $start_from='begin', $limit=999 )?>

This displays the image associated with a post’s categories.

Arguments

-

$separator

Optional argument. The text and/or HTML to appear between each of a post’s category images.

-

$parents

Optional argument. Allows you to specify if you want ancestor categories of a post’s category to be imaged and linked as well. Valid options are ‘multiple’, ‘single’, and ”.

Default is ”.

-

$image_extensions

Optional argument. A space-separated list of image extensions (case insensitive). If defined as ” then no image is retrieved and the category name is displayed instead (a la the_category() ).

Default is ‘png gif jpg’.

-

$image_dir

Optional argument. The directory in which the category image(s) reside. The value should be a location relative to the main URL of your blog.

Default is ‘/wp-content/images/’

-

$use_name_if_no_image

Optional argument. Boolean value (true or false) indicating if the name of the category should be displayed for each category that does not have an associated image. Default is false.

-

$start_from

Optional argument. How to traverse the list of post’s categories; either ‘begin’ or ‘end’. Default is ‘begin’

-

$limit

Optional argument. The maximum number of category images to be displayed. Default is 999 (basically, no limit)

-

$post_id

Optional argument. The Post ID. e.

while in the loop). Default is false.

Examples

-

You can opt to treat only certain categories as having a graphical representation by defining an image for them but not creating images for the non-graphically represented categories (as in you can have a subset of categories that dictate what image to be displayed for the post).

-

e. if showing a $single post, choose to use a ‘png’ image, otherwise use ‘gif’; or locate your images in different directories ‘/wp-content/images/cat-images/small/’ and ‘/wp-content/images/cat-images/large/’ and decide based on context where to get the image(s) from:

// In showing the post singularly, then use a larger image, else use a small image

if ( is_single() ) {

c2c_the_category_image(”, ”, ‘gif’, ‘/wp-content/images/cat-images/large/’);

} else {

c2c_the_category_image(”, ”, ‘gif’, ‘/wp-content/images/cat-images/small/’);

}

-

Show all images in a comma-separated line:

-

Show all images in an unordered list:

-

Assuming one category per post, just show the category image without further HTML markup:

php c2c_the_category_image(' '); // note the space in the argument, necessary to turn off default

>

Filters

The plugin exposes two filters and one action for hooking. php file, or used by another plugin.

c2c_get_category_image (filter)

The ‘c2c_get_category_image’ hook allows you to use an alternative approach to safely invoke c2c_get_category_image() in such a way that if the plugin were deactivated or deleted, then your calls to the function won’t cause errors in your site.

Arguments:

  • same as for c2c_get_category_image()

Example:

Instead of:

>

Do:

>

c2c_get_the_category_image_list (filter)

The ‘c2c_get_the_category_image_list’ hook allows you to use an alternative approach to safely invoke c2c_get_the_category_image_list() in such a way that if the plugin were deactivated or deleted, then your calls to the function won’t cause errors in your site.

Arguments:

  • same as for c2c_get_the_category_image_list()

Example:

Instead of:

>

Do:

>

c2c_the_category_image (action)

The ‘c2c_the_category_image’ hook allows you to use an alternative approach to safely invoke c2c_the_category_image() in such a way that if the plugin were deactivated or deleted, then your calls to the function won’t cause errors in your site.

Arguments:

  • same as for c2c_the_category_image()

Example:

Instead of:

>

Do:

>

WordPress.org metadata

Plugin tags

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

  • categories
  • category
  • icon
  • image
  • post
Compatibility & maintenance

Compatibility & maintenance

Tested up to WordPress 3.4

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

Current WordPress releaseWordPress 7.1
WordPress.org Tested up to3.4
Minimum requirementsWordPress 2.2 · PHP not listed
Update activity11 Jun 201214y 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.