{"id":1477,"date":"2004-12-21T21:15:09","date_gmt":"2004-12-21T21:15:09","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/category-images\/"},"modified":"2012-06-11T06:28:33","modified_gmt":"2012-06-11T06:28:33","slug":"category-images","status":"publish","type":"plugin","link":"https:\/\/th.wordpress.org\/plugins\/category-images\/","author":3606,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.7.3","stable_tag":"1.7.3","tested":"3.4.2","requires":"2.2","requires_php":"","requires_plugins":"","header_name":"Category Images","header_author":"Scott Reilly","header_description":"","assets_banners_color":"","last_updated":"2012-06-11 06:28:33","external_support_url":"","external_repository_url":"","donate_link":"http:\/\/coffee2code.com\/donate","header_plugin_uri":"http:\/\/coffee2code.com\/wp-plugins\/category-images\/","header_author_uri":"http:\/\/coffee2code.com\/","rating":4.5,"author_block_rating":0,"active_installs":100,"downloads":31057,"num_ratings":2,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","changelog"],"tags":[],"upgrade_notice":{"1.7.3":"<p>Trivial update: noted compatibility through WP 3.4+; explicitly stated license<\/p>","1.7.2":"<p>Trivial update: noted compatibility through WP 3.3+<\/p>","1.7.1":"<p>Trivial update: noted compatibility through WP 3.2+<\/p>","1.7":"<p>Recommended update. Highlights: added multiple hooks to allow customization; made leading and trailing slashes in paths optional; allow sending post_id arg to c2c_get_the_category_image_list(); verified WP 3.0 compatibility; other miscellaneous tweaks and fixes.<\/p>"},"ratings":{"1":0,"2":0,"3":0,"4":"1","5":"1"},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.7","1.7.1","1.7.2","1.7.3","v1.0","v1.1"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[610,89,497,133,86],"plugin_category":[50,57],"plugin_contributors":[78189],"plugin_business_model":[],"class_list":["post-1477","plugin","type-plugin","status-publish","hentry","plugin_tags-categories","plugin_tags-category","plugin_tags-icon","plugin_tags-image","plugin_tags-post","plugin_category-media","plugin_category-taxonomy","plugin_contributors-coffee2code","plugin_committers-coffee2code"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/category-images.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>Display an image for each category associated with a post.<\/p>\n\n<p>Notes:<\/p>\n\n<p>This plugin provides the templates tag <code>c2c_the_category_image()<\/code> which basically reproduces and extends the functionality of WordPress's core function <code>the_category()<\/code> 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 <code>\"\"<\/code>, the plugin could be a drop-in replacement for <code>the_category()<\/code>.  As is done in <code>the_category()<\/code>, the image or text for each category is also a link back to that category's archive.<\/p>\n\n<p>Related info about the function:<\/p>\n\n<ul>\n<li>If $image_extensions is defined, but no image is found for the category, then nothing is displayed for that category.<\/li>\n<li>$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'.<\/li>\n<li>The number of category links\/images displayed can be limited via the $limit argument<\/li>\n<li>Category image  tags are defined with class=\"catimage\" for stylesheet manipulation.<\/li>\n<li>The result can be filtered via the filter named \"c2c_the_category_image\".<\/li>\n<li><p>Must be run inside \"the loop\".<\/p>\n\n<p>c2c_get_category_image_list() is another provided function, which is identical to <code>c2c_the_category_image()<\/code> except that it doesn't echo the result.<\/p><\/li>\n<\/ul>\n\n<p>Links: <a href=\"http:\/\/coffee2code.com\/wp-plugins\/category-images\/\">Plugin Homepage<\/a> | <a href=\"http:\/\/wordpress.org\/extend\/plugins\/category-images\/\">Plugin Directory Page<\/a> | <a href=\"http:\/\/coffee2code.com\">Author Homepage<\/a><\/p>\n\n<h3>Template Tags<\/h3>\n\n<p>The plugin provides one optional template tag for use in your theme templates.<\/p>\n\n<h4>Functions<\/h4>\n\n<ul>\n<li><code>&lt;?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 ) ?&gt;<\/code><\/li>\n<\/ul>\n\n<p>This displays the image associated with a post's categories.<\/p>\n\n<h4>Arguments<\/h4>\n\n<ul>\n<li><p><code>$separator<\/code>\nOptional argument.  The text and\/or HTML to appear between each of a post's category images.<\/p><\/li>\n<li><p><code>$parents<\/code>\nOptional 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 ''.<\/p><\/li>\n<li><p><code>$image_extensions<\/code>\nOptional 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 <code>the_category()<\/code>).  Default is 'png gif jpg'.<\/p><\/li>\n<li><p><code>$image_dir<\/code>\nOptional 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\/'<\/p><\/li>\n<li><p><code>$use_name_if_no_image<\/code>\nOptional 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.<\/p><\/li>\n<li><p><code>$start_from<\/code>\nOptional argument.  How to traverse the list of post's categories; either 'begin' or 'end'.  Default is 'begin'<\/p><\/li>\n<li><p><code>$limit<\/code>\nOptional argument.  The maximum number of category images to be displayed.  Default is 999 (basically, no limit)<\/p><\/li>\n<li><p><code>$post_id<\/code>\nOptional argument.  The Post ID.  If false, then use the current post (i.e. while in the loop).  Default is false.<\/p><\/li>\n<\/ul>\n\n<h3>Examples<\/h3>\n\n<ul>\n<li><p>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).<\/p><\/li>\n<li><p>You can take advantage of the $image_extension and\/or $image_dir arguments to display different category icons under different contexts, i.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:<\/p>\n\n<p>\/\/ In showing the post singularly, then use a larger image, else use a small image\n  if ( is_single() ) {\n    c2c_the_category_image('', '', 'gif', '\/wp-content\/images\/cat-images\/large\/');\n  } else {\n    c2c_the_category_image('', '', 'gif', '\/wp-content\/images\/cat-images\/small\/');\n  }<\/p><\/li>\n<li><p>Show all images in a comma-separated line:<\/p>\n\n<\/li>\n<li><p>Show all images in an unordered list:<\/p>\n\n<\/li>\n<li><p>Assuming one category per post, just show the category image without further HTML markup:<\/p>\n\n&lt; ?php c2c_the_category_image(&#039; &#039;);  \/\/ note the space in the argument, necessary to turn off default <ul> markups ?&gt;\n\n<h3>Filters<\/h3>\n\n<p>The plugin exposes two filters and one action for hooking.  Typically, customizations utilizing these hooks would be put into your active theme's functions.php file, or used by another plugin.<\/p><\/li>\n<\/ul>\n\n<h4>c2c_get_category_image (filter)<\/h4>\n\n<p>The 'c2c_get_category_image' hook allows you to use an alternative approach to safely invoke <code>c2c_get_category_image()<\/code> 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.<\/p>\n\n<p>Arguments:<\/p>\n\n<ul>\n<li>same as for <code>c2c_get_category_image()<\/code><\/li>\n<\/ul>\n\n<p>Example:<\/p>\n\n<p>Instead of:<\/p>\n\n<pre><code>    &lt;?php $cat_images = c2c_get_category_image( $cat ); ?&gt;\n<\/code><\/pre>\n\n<p>Do:<\/p>\n\n<pre><code>    &lt;?php $cat_images = apply_filters( 'c2c_get_category_image', $cat ); ?&gt;\n<\/code><\/pre>\n\n<h4>c2c_get_the_category_image_list (filter)<\/h4>\n\n<p>The 'c2c_get_the_category_image_list' hook allows you to use an alternative approach to safely invoke <code>c2c_get_the_category_image_list()<\/code> 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.<\/p>\n\n<p>Arguments:<\/p>\n\n<ul>\n<li>same as for <code>c2c_get_the_category_image_list()<\/code><\/li>\n<\/ul>\n\n<p>Example:<\/p>\n\n<p>Instead of:<\/p>\n\n<pre><code>    &lt;?php $cat_list = c2c_get_the_category_image_list(); ?&gt;\n<\/code><\/pre>\n\n<p>Do:<\/p>\n\n<pre><code>    &lt;?php $cat_list = apply_filters( 'c2c_get_the_category_image_list', '' ); ?&gt;\n<\/code><\/pre>\n\n<h4>c2c_the_category_image (action)<\/h4>\n\n<p>The 'c2c_the_category_image' hook allows you to use an alternative approach to safely invoke <code>c2c_the_category_image()<\/code> 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.<\/p>\n\n<p>Arguments:<\/p>\n\n<ul>\n<li>same as for <code>c2c_the_category_image()<\/code><\/li>\n<\/ul>\n\n<p>Example:<\/p>\n\n<p>Instead of:<\/p>\n\n<pre><code>    &lt;?php c2c_the_category_image(); ?&gt;\n<\/code><\/pre>\n\n<p>Do:<\/p>\n\n<pre><code>    &lt;?php do_action( 'c2c_the_category_image' ); ?&gt;\n<\/code><\/pre>\n\n<!--section=installation-->\n<ol>\n<li>Unzip <code>category-images.zip<\/code> inside the <code>\/wp-content\/plugins\/<\/code> directory (or install via the built-in WordPress plugin installer)<\/li>\n<li>Activate the plugin through the 'Plugins' admin menu in WordPress<\/li>\n<li>Create category image (.png unless you specify the extension in your call to <code>c2c_the_category_image()<\/code>) for each category you wish to have an image for, placing the image into the wp-content\/images\/ directory (unless you specify another location in your call to <code>c2c_the_category_image()<\/code>).  Remember to give the filename the nice-name version of the category name.<\/li>\n<li>Make use of the <code>c2c_the_category_image()<\/code> template function in your template (see examples below).<\/li>\n<\/ol>\n\n<!--section=changelog-->\n<h4>1.7.3<\/h4>\n\n<ul>\n<li>Re-license as GPLv2 or later (from X11)<\/li>\n<li>Add 'License' and 'License URI' header tags to readme.txt and plugin file<\/li>\n<li>Remove ending PHP close tag<\/li>\n<li>Note compatibility through WP 3.4+<\/li>\n<\/ul>\n\n<h4>1.7.2<\/h4>\n\n<ul>\n<li>Note compatibility through WP 3.3+<\/li>\n<li>Add link to plugin directory page to readme.txt<\/li>\n<li>Note many TODO ideas<\/li>\n<li>Update copyright date (2012)<\/li>\n<\/ul>\n\n<h4>1.7.1<\/h4>\n\n<ul>\n<li>Note compatibility through WP 3.2+<\/li>\n<li>Minor code formatting changes (spacing)<\/li>\n<li>Minor readme.txt formatting changes<\/li>\n<li>Add plugin homepage and author links in description in readme.txt<\/li>\n<li>Update copyright date (2011)<\/li>\n<\/ul>\n\n<h4>1.7<\/h4>\n\n<ul>\n<li>Rename filter 'c2c_the_category_image' to 'c2c_category_image_list'<\/li>\n<li>Add hooks 'c2c_get_category_image' (filter), 'c2c_get_the_category_image_list' (filter), and 'c2c_the_category_image' (action) to respond to the function of the same name so that users can use the apply_filters() or do_action() notation for invoking template tags<\/li>\n<li>Change to make leading and trailing forward slashes optional for $image_dir value<\/li>\n<li>Wrap each global function in function_exists() check<\/li>\n<li>Remove docs from top of plugin file (all that and more are in readme.txt)<\/li>\n<li>Note compatibility with WP 2.9+, 3.0+<\/li>\n<li>Minor tweaks to code formatting (spacing)<\/li>\n<li>Add Changelog, Filters, and Upgrade Notice sections to readme.txt<\/li>\n<li>Add PHPDoc documentation<\/li>\n<li>Add package info to top of plugin file<\/li>\n<li>Update copyright date<\/li>\n<li>Remove trailing whitespace<\/li>\n<\/ul>\n\n<h4>1.6 (unreleased)<\/h4>\n\n<p>=\n* Add optional arg $post_id (default of false) to c2c_get_the_category_image_list() to allow specifying a post\n* Send $separator as arg in calls to get_category_parents()\n* Use get_options() instead of get_settings()\n* Note compatibility with WP 2.6+, 2.7+, 2.8+\n* Update copyright date<\/p>\n\n<h4>1.5<\/h4>\n\n<ul>\n<li>Move plugin into its own sub-directory<\/li>\n<li>Lots of changes to ensure compatibility with latest releases of WP<\/li>\n<li>Add function c2c_get_the_category_image_list() and move code from c2c_the_category_image() into it (but non-echoing though)<\/li>\n<li>Change c2c_the_category_image() to simply echo result of c2c_get_the_category_image_list()<\/li>\n<li>Use $cat-&gt;name instead $cat-&gt;cat_name<\/li>\n<li>Use term_id instead of cat_ID<\/li>\n<li>Allow filter of result via the filter named \"c2c_the_category_image\".<\/li>\n<li>Add readme.txt<\/li>\n<li>Minor code formatting changes<\/li>\n<li>Add installation instructions<\/li>\n<li>Change plugin description<\/li>\n<li>Change Plugin URI<\/li>\n<li>Change Author  URI<\/li>\n<li>Note compatibility with WP 2.3+, 2.5+<\/li>\n<li>Update copyright date<\/li>\n<\/ul>\n\n<h4>1.2<\/h4>\n\n<ul>\n<li>Compatibility fix for WP1.5.1<\/li>\n<\/ul>\n\n<h4>1.1<\/h4>\n\n<ul>\n<li>Same as v1.0 but compatible with WP1.5+<\/li>\n<li>Change to accommodate new get_category_link() arguments<\/li>\n<\/ul>\n\n<h4>1.0<\/h4>\n\n<ul>\n<li>Last version compatible with WP 1.2<\/li>\n<li>Add argument $use_name_if_no_image=false to allow showing cat name if no image was located<\/li>\n<li>Tweaks to update c2c_the_category_image() with changes made to the_category() (mostly rel= stuff)<\/li>\n<li>Change default category images directory from \/wp-images\/ to \/wp-content\/images\/<\/li>\n<\/ul>\n\n<h4>0.92<\/h4>\n\n<ul>\n<li>Fix a pair of typos that prevented images from showing<\/li>\n<\/ul>\n\n<h4>0.91<\/h4>\n\n<ul>\n<li>Now supports listing multiple image extensions<\/li>\n<li>Prepended all functions with \u201cc2c_\u201d to avoid potential function name collision with other plugins or future core functions\u2026 NOTE: If you are upgrading from an earlier version of the plugin, you\u2019ll need to change your calls from the_category_image() to c2c_category_image()<\/li>\n<li>Change from BSD-new license to MIT license<\/li>\n<\/ul>\n\n<h4>0.9<\/h4>\n\n<ul>\n<li>Initial public release<\/li>\n<\/ul>","raw_excerpt":"Display an image for each category associated with a post.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/th.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/1477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/th.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/th.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"author":[{"embeddable":true,"href":"https:\/\/th.wordpress.org\/plugins\/wp-json\/wp\/v2\/users\/3606"}],"replies":[{"embeddable":true,"href":"https:\/\/th.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=1477"}],"wp:attachment":[{"href":"https:\/\/th.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=1477"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/th.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=1477"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/th.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=1477"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/th.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=1477"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/th.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=1477"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/th.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=1477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}