Taxonomy Images Plugin

By Michael Fields

For usage instructions please view the screencast.

Displaying Your Images in Your Theme

There are a few filters that you can use in your theme to display the image associations created by this plugin. Please read below for detailed information.

Display a single image representing the term archive

The following filter will display the image associated with the term asked for in the query string of the url. This filter only works in views that naturally use templates like category.php, tag.php taxonomy.php and all of their derivatives. Please read about template hierarchy for more information about these templates. The simplest use of this filter looks like:

print apply_filters( 'taxonomy-images-queried-term-image', '' );

This code will generate and print an image tag. It’s output can be modifed by passig an optional third parameter to apply filters. This parameter is an array and the following keys may be set:

  • after (string) – Text to append to the image’s HTML.

  • attr (array) – Key/value pairs representing the attributes of the img tag. Available options include: alt, class, src and title. This array will be passed as the fourth parameter to WordPress core function wp_get_attachment_image() without modification.

  • before (string) – Text to prepend to the image’s HTML.

  • image_size (string) – May be any image size registered with WordPress. If no image size is specified, ‘thumbnail’ will be used as a default value. In the event that an unregistered size is specified, this filter will return an empty string.

Here’s an example of what a fully customized version of this filter might look like:

print apply_filters( 'taxonomy-images-queried-term-image', '', array(
    'after' => '</div>'
    'attr' => array(
        'alt'   => 'Custom alternative text',
        'class' => 'my-class-list bunnies turtles',
        'src'   => 'this-is-where-the-image-lives.png',
        'title' => 'Custom Title',
        ),
    'before' => '<div id="my-custom-div">',
    'image_size' => 'medium',
    ) );

Similar functionality

If you just need to get the database ID for the image, you may want to use:

$image_id = apply_filters( 'taxonomy-images-queried-term-image-id', 0 );

If you need to get the full object of the image, you may want to use:

$image = apply_filters( 'taxonomy-images-queried-term-image-object', '' );

If you need to get the url to the image, you may want to use the following:

$image_url = apply_filters( 'taxonomy-images-queried-term-image-url', '' );

You can specify the size of the image in an option third parameter:

$image_url = apply_filters( 'taxonomy-images-queried-term-image-url', '', array(
    'image_size' => 'medium'
    ) );

If you need data about the image, you may want to use:

$image_data = apply_filters( 'taxonomy-images-queried-term-image-data', '' );

You can specify the size of the image in an option third parameter:

$image_data = apply_filters( 'taxonomy-images-queried-term-image-data', '', array(
    'image_size' => 'medium'
    ) );

List term images associated with a post object

When a post is being displayed you may want to display all of the images associated with all of the terms that are associated with the post (a mouthful? Yes indeed!). The taxonomy-images-list-the-terms filter does this. Here’s what it looks like in its simplest form:

print apply_filters( 'taxonomy-images-list-the-terms', '' );

This filter accepts an optional third parameter that you can use to customize its output. It is an array which recognizes the following keys:

  • after (string) – Text to append to the output. Default value is a closing unordered list element.

  • after_image (string) – Text to append to each image. Default value is a closing list-item element.

  • before (string) – Text to prepend to the output. Default value is an open unordered list element with an class attribute of “taxonomy-images-the-terms”.

  • before_image (string) – Text to prepend to each image. Default value is an open list-item element.

  • image_size (string) – Any registered image size. Values will vary from installation to installation. Image sizes defined in core include: “thumbnail”, “medium” and “large”. “Fullsize” may also be used to get the unmodified image that was uploaded. Defaults to “thumbnail”.

  • post_id (int) – The post to retrieve terms from. Defaults to the ID property of the global $post object.

  • taxonomy (string) – Name of a registered taxonomy to return terms from. Defaults to “category”.

Here’s an example of what a fully customized version of this filter might look like:

print apply_filters( 'taxonomy-images-list-the-terms', '', array(
    'after'        => '</div>',
    'after_image'  => '</span>',
    'before'       => '<div class="my-custom-class-name">',
    'before_image' => '<span>',
    'image_size'   => 'detail',
    'post_id'      => 1234,
    'taxonomy'     => 'post_tag',
    ) );

Working with all terms of a given taxonomy

You will want to use the ‘taxonomy-images-get-terms’ filter. This filter is basically a wrapper for WordPress core function get_terms(). It will return an array of enhanced term objects: each term object will have a custom property named image_id which is an integer representing the database ID of the image associated with the term. This filter can be used to create custom lists of terms. Here’s what it’s default useage looks like:

$terms = apply_filters( 'taxonomy-images-get-terms', '' );

Here is what php’s print_r() function may return:

Array
(
    [0] => stdClass Object
        (
            [term_id] => 8
            [name] => Pirate
            [slug] => pirate
            [term_group] => 0
            [term_taxonomy_id] => 8
            [taxonomy] => category
            [description] => Pirates live in the ocean and ride around on boats.
            [parent] => 0
            [count] => 1
            [image_id] => 44
        )
)

As you can see, all of the goodness of get_terms() is there with an added bonus: the image_id parameter!

This filter recognizes an optional third parameter which is an array of arguments that can be used to modify its output:

  • cache_images (bool) If this value is true all assocaite images will be queried for and cached for later use in various template tags. If it is set to false, this query will be suppressed. Do not set this value to false unless you have a really good reason for doing so :) Default value is true.

  • having_images (bool) If this value is true then only terms that have associated images will be returned. Setting it to false will return all terms. Default value is true.

  • taxonomy (string) Name of a registered taxonomy to return terms from. Multiple taxonomies may be specified by separating each name by a comma. Defaults to “category”.

  • term_args (array) Arguments to pass to get_terms() as the second parameter. Default value is an empty array.

Here’s and example of a simple custom loop that you can make to display all term images:

$terms = apply_filters( 'taxonomy-images-get-terms', '' );
if ( ! empty( $terms ) ) {
    print '<ul>';
    foreach( (array) $terms as $term ) {
        print '<li><a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">' . wp_get_attachment_image( $term->image_id, 'detail' ) . '</li>';
    }
    print '</ul>';
}

Support

If you have questions about integrating this plugin into your site, please add a new thread to the WordPress Support Forum. I try to answer these, but I may not always be able to. In the event that I cannot there may be someone else who can help.

Bugs, Suggestions

Development of this plugin is hosted in a public repository on Github. If you find a bug in this plugin or have a suggestion to make it better, please create a new issue

Hook it up yo!

If you have fallen in love with this plugin and would not be able to sleep without helping out in some way, please see the following list of ways that you can hook it up!:

  • Rate it! – Use the star tool on the right-hand sidebar of the homepage.

  • Let me know if it works – Use the Compatibility widget on the homepage to let everyone know that the current version works with your version of WordPress.

  • Do you Twitter? Help promote by using this shortlink: http://bit.ly/taxonomy-images

  • Are you a writer? Help promote by writing an article on your website about this plugin.

  • Are you Super-Wicked-Awesome? If so, you can always make a donation.

Need More Taxonomy Plugins?

I’ve released a handfull of plugins dealing with taxonomies. Please see my plugin page for more info.

Download

Latest version: Download Taxonomy Images Plugin v0.8.0 [zip]

Installation

  1. Download
  2. Unzip the package and upload to your /wp-content/plugins/ directory.
  3. Log into WordPress and navigate to the “Plugins” panel.
  4. Activate the plugin.
  5. Click the “Taxonomy Images” link under the Settings section in the admin menu. There you can select the taxonomies that you would like to add image support for.

Changelog

0.8.0

  • Pass an empty array as default second parameter of taxonomy_images_plugin_get_the_terms() and taxonomy_images_plugin_list_the_terms().
  • Use jQuery.on() instead of jQuery.live(). Props jamiemchale.
  • Give the button on the custom admin screen a class of button-primary.
  • Store the return value of get_posts() in a variable called $images. Not sure why, but this should not harm anything.
  • Change license to GPLv2 or later for maximum flexibility and compatibility.
  • Add jamiemchale as a contributor.
  • Random whitespace fixes.
  • Update Documentation.
  • CSS coding standards.
  • Bump version number.
  • Update Readmes.

0.7.3

  • Fixed the delete image button on edit-terms.php.
  • Better escaping.
  • Introduced pot file and languages directory.

0.7.2

0.7.1

  • Remove unused link code which is throwing an error when no taxonomies support images.

0.7

  • No longer breaks display of the Better Plugin Compatibility Control plugin.
  • Created a custom filter interface for plugin and theme integration.
  • Lots of inline documentation added.
  • Added custom notices if plugin is used in an unsupported way.
  • No notices generated by PHP or WordPress.
  • Deprecated function calls removed.
  • Security updates.
  • All strings are now internationalized.
  • Add image to term functionality mimics “Add Featured Image”.
  • Taxonomy modal button now available in search + upload states.
  • Image interface has been added to single term edit screen.
  • Users can now choose which taxonomys have image support.
  • All functions are now private.
  • Shortcode deprecated.
  • All global variables and constants have been removed or deprecated.

0.6

  • Never released.
  • Completely recoded.

0.5

  • UPDATE: Direct link to upload new files from edit-tag.php has been introduced.
  • UPDATE: Ability to create an image/term association immediately after upload has been introduced.
  • UPDATE: Users can now delete image/term associations.
  • UPDATE: Created standalone javascript files – removed inline scripts.
  • UPDATE: Obsesive compulsive syntax modifications.
  • UPDATE: Localization for strings – still need to “fine-tooth-comb” this.
  • UPDATE: Removed all debug functions.

0.4.4

  • BUGFIX: get_image_html() Now populates the image’s alt attribute with appropriate data. Props to jaygoldman.

0.4.3

  • UPDATE: Support for WordPress 3.0 has been added. Support for all beta versions of 3.0 has been dropped.
  • COMPAT: Removed use of deprecated function is_taxonomy() – props to anointed.
  • COMPAT: Included a definition for taxonomy_exists() function for backwards compatibility with 2.9 branch. This function is new in WordPress version 3.0.

0.4.2

  • UPDATE: Changed button name from “Category” to “Taxonomy”.
  • UPDATE: Support for 2.9 branch has been added again.

0.4.1

  • UPDATE: Added support for dynamic taxonomy hooks for _tag_row()
  • BROKEN: Support for 2.9 branch has been temporarily removed.

0.4

  • BUGFIX: get_thumb() now returns the fullsize url if there is no appropriate intermediate image.
  • UPDATE: Added “taxonomy_images_shortcode”.

0.3

  • COMPAT: Changed the firing order of every hook untilizing the ‘category_rows’ method to 15. This allows this plugin to be compatible with Reveal IDs for WP Admin. Thanks to Peter Kahoun
  • COMPAT: Added Version check for PHP5.
  • UPDATE: $settings and $locale are now public properties.
  • UPDATE: Object name changed to: $taxonomy_images_plugin.
  • UPDATE: Added argument $term_tax_id to both print_image_html() and get_image_html().
  • BUGFIX: Deleted the register_deactivation_hook() function -> sorry to all 8 who downloaded this plugin so far :)

0.2

  • Original Release – Works With: wp 2.9.1.

88 Comments Comments are closed

  1. RozaniGhani July 18, 2010 at 8:33 am

    Can you make the thumbnail can be preview like Justin Tadlock’s blog? Just like his homepage index.php.

  2. Michael Fields July 18, 2010 at 11:10 am

    Rozani,
    I’m not sure how a site’s home page relates to this plugin. It’s intention is to enable administrators to associate an image to a taxonomy. Images can be associated to posts via the WordPress “Featured Image” interface.

  3. RozaniGhani July 18, 2010 at 12:25 pm

    You already done a great job. Thanks a lot.

  4. Maíra July 27, 2010 at 3:52 am

    Hi! Finding this plugin was a bliss – I was cracking my head trying to list the authors of a post (I’m using a custom taxonomy for that) on the sidebar. To do that, I made a slight modification: instead of using the get_terms() I used the get_the_terms() funcion, with the $post->ID attribute, on the shortcode definition.
    It might be an interesting (and simple, I’m guessing) feature to add: a shortcode to the plugin to do just that – list the terms of a taxonomy associated with a post.

    (Sorry if I used wrong terms, I’m not really a coder or anything..!)

  5. Michael Fields July 27, 2010 at 3:58 am

    Hi Maria,
    Thanks for writing. I’m glad that the plugin was useful to you and I will definitely consider the additions of this shortcode to the next release. Might not be for another month or so. Currently working on a very big project.

  6. Allen August 5, 2010 at 6:06 am

    Trying to activate the plugin and I am getting a error:

    Plugin could not be activated because it triggered a fatal error.

    Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /homepages/2/d295050492/htdocs/KSLive/wp-content/plugins/taxonomy-images/taxonomy-images.php on line 62

    I don’t have any other plugins active.

  7. Michael Fields August 6, 2010 at 11:03 am

    What version of php are you running? Also, which version of the plugin? Line 62 of Taxonomy Images BETA 0.5 is the start of the taxonomy_images_plugin class which defines the first property as ‘public’. This leads me to believe that your version of PHP is not compatible with this plugin. Sorry.

  8. Alexandra Zsigmond August 14, 2010 at 7:57 pm

    Hi Michael,

    Many thanks for this plugin, as well as the Taxonomy widget. So helpful!
    Now what I’m needing is a combination of the two. I’m wanting to display an unordered list of the terms in one taxonomy, as well as the image associated with each term, in the sidebar on my homepage. Do you have a suggestion as to how I would go about that? Any advice would be much appreciated, even if brief.
    Thanks for any response!!

  9. ovidiu August 23, 2010 at 12:47 pm

    I am not sure if this plugin is what I am looking for but I wanted to associate icons (not really images) to categories/tags/custom taxonomies. I want to be able to show a specific icon next to everything that shows on my homepage, giving visitors an instant recognition effect :-)

    does this plugin do that?

  10. Michael Fields August 23, 2010 at 1:46 pm

    Not sure what you mean by icons… but this plugin will allow you to associate any image file to any term of a visible taxonomy. I have not tested it with .ico files.

  11. ovidiu August 23, 2010 at 1:53 pm

    Ok, forget about icons. Lets say I want images sized 25px by 25px nest to my category names or next to my other custom taxonomies. Should be ok so far but I could not find where to associate a picture with a custom taxonomy. I found the option for categories though.
    Have you tested it with a custom taxonomy?

  12. Michael Fields August 23, 2010 at 2:02 pm

    Yep, This plugin has been thoroughly tested with terms of custom taxonomies associated with multiple post_types.

  13. ovidiu August 23, 2010 at 2:10 pm

    will give it a try, thx.

  14. James September 3, 2010 at 6:32 pm

    I really like the taxonomy images plugin. Once I associate an image with a category if I want to remove the image association later how do I do that?

  15. bill streeter September 6, 2010 at 12:20 am

    Having a little issue with assigning a thumb to the category. I click the ? icon to select an image and I get the media dialogue box. I am guessing the insert into post is the selection to make but the thick box just turns white and doesn’t do anything. I waited a while and eventually closed it. Is this a compatibility issue with WP 3.01? I assume that’s why the media selection box looks different than in your screencast.

  16. bill streeter September 6, 2010 at 12:26 am

    Just to be clear I’m not getting the “add image to category” button at all, only the “edit image” button in the media library dialogue.

  17. bill streeter September 6, 2010 at 3:27 am

    Neve rmind. Fixed it. Had a conflict with another plugin

  18. Matvey September 7, 2010 at 2:16 pm

    Hi Michael!
    Thanks a lot for this great plugin
    But I have some problems
    I want to show taxonomy names and icons in query on my sidebar. (each entry in this query consists of specific taxonomy name, taxonomy image, title of a post and excerpt)

    In case with categories i can do it using the Category Images II plugin and code like this:

    $args = array(
    'child_of' => 7,
    'showposts' => 3,
    );
    $columnPosts->query($args);
     
    while($columnPosts->have_posts()) :
    $columnPosts->the_post();
    ?>
     

    ...and so on

    But with Taxonomy Images plugin such a trick doesn't work.
    Any solutions?

  19. Matvey September 7, 2010 at 2:18 pm

    code has broken

    'child_of=8',
    showposts => '3',
    );

    $columnPosts->query($args);
    while($columnPosts->have_posts()) :
    $columnPosts->the_post();

    ?>

    <a href="" rel="bookmark">

  20. Matvey September 7, 2010 at 2:23 pm

    sorry, ones more

    look the code here, please https://docs.google.com/View?id=ajb2wqtbpfmc_203fv4b2mgq

  21. Josh Byers September 7, 2010 at 5:34 pm

    Love this plugin. Thank you very much.

    Feature Requests:
    -Allow via settings page to choose which tax/cat/tag can have images associated
    -If you can’t find a way to be able to add the image on upload, maybe add some text to let the user know to close the upload box and then click the add button again?

    If you are interested I re-created the buttons to better fit the WordPress UI. Feel free to integrate them into the plugin if you want.
    http://lakesidefellowship.com/wp-content/plugins/taxonomy-images/default-image.png

    The deleted image is there as well – just replace “default” with “deleted” (didn’t want the comment to be marked as spam bc of too many links :)

    Thanks again – this is an amazing plugin.

  22. Michael Fields September 8, 2010 at 3:34 pm

    Thanks for taking the time to write!

    “Allow via settings page to choose which tax/cat/tag can have images associated”

    I have thought about implementing this as well, but this will probably be put on hold till the next release. Great idea!

    If you can’t find a way to be able to add the image on upload, maybe add some text to let the user know to close the upload box and then click the add button again?

    People have been wondering about this for a while now… I decided to dig deeper into core to try and find a solution. And it works now… As of 0.5. I guess you may be the proverbial straw the broke the camel’s back :)

    f you are interested I re-created the buttons to better fit the WordPress UI. Feel free to integrate them into the plugin if you want.

    Thanks. I think I’ll leave them for the time being though. IMO it’s best to have the buttons be the same size as the images for the time being… Maybe once it gets out of BETA I’ll think about revisiting design.

  23. Michael Fields September 10, 2010 at 8:55 am

    James, Sorry for the oversight. I added the ability to delete term/image associations in version 0.5.

  24. Michael Fields September 10, 2010 at 8:56 am

    Glad you figured it out. Which plugin did you have a conflict with? Maybe I can work around it so this doesn’t happen in the future.

  25. Bill Streeter September 12, 2010 at 11:38 pm

    It was a plugin called Simple Post Thumbnails which is pretty much made obsolete by the featured image function in WordPress 2.9 and up. So not a big deal to delete it.

    Another couple of questions:
    Is there a way to control how the thumbnail is cropped? I’m not having any luck using the wordpress image tool to crop the thumbnail the way I would like. I am using large banner width (landscape) images in full size mode and would like to use an 80×80 cropped version as the thumbnail elsewhere in my theme (kinda like an icon)

    Also how can I display the image on a post or a page as part of the theme?

  26. Michael Fields September 12, 2010 at 11:56 pm

    Glad to hear that I don’t need to step around another plugin ;) I would though, for the record.

    Currently, WordPress only allows us to single-out the “thumbnail” for cropping. I would suggest reworking your theme a bit. Set the “thumbnail” size to 80×80 and then you will be able to crop only this size.

    I don’t have a fast answer for your second question. Check back in a few days and I’ll fix up an easy way of accomplishing this. Reason 5 the plugin is still in BETA :)

  27. James September 13, 2010 at 1:53 pm

    Perfect, thanks Michael.

  28. Michael Fields December 24, 2010 at 11:00 am

    Hi just wanted to let everyone following this post know that there is a release candidate for version 0.6 of this plugin available. If you have a few minutes and could help to with testing that would be rad! Taxonomy Images 0.6-RC1

  29. shawn January 10, 2011 at 9:26 pm

    Testing the new 0.6RC1 and I noticed that I no longer have the option to upload an image for my custom taxonomies. Only the categories taxonomy shows the image upload area.

    Is there a new setting somewhere that allows me to assign images to custom taxonomies that belong to custom post-types?

    Other than that, seems to work properly

  30. Michael Fields January 10, 2011 at 9:28 pm

    Hi Shawn, Thanks for taking a look. Are you by chance using WordPress 2.9? I have dropped support for 2.9 in 0.6RC1. If not, please let me know which version you are using so I can run some tests.

  31. shawn January 10, 2011 at 10:00 pm

    Sorry about that, was a false report.

    I am using 3.1RC1

    What was happening, is that I had not yet added a term to the custom taxonomy yet. Once I did that, then the upload area showed up.

    btw
    I’ve been playing around just a bit with taxonomies and have a very closely related question. Will send an email for advice.

    thanks, plugin is working perfectly for me.

  32. xSEOn January 28, 2011 at 1:41 pm

    Great plugin, I just wanted to suggest to make it international. I’d gladly provide a translation for Bulgarian. :)

    In addition, I am very glad you posted the solution for showing up the images with URL. With some minor changes, I made it unordered list and used it like menu for my categories showing all subcategories of category 14 including the empty ones and it looks fantastic. Here is my code:

    <ul class="catimglist">
    <?php	$cats = get_categories( 'parent=14&hide_empty=0' );
    foreach ( $cats as $c ) {
    $url = get_category_link( $c->term_id );
    $img = $taxonomy_images_plugin->get_image_html( 'medium', $c->term_taxonomy_id );
    if( !empty( $img ) )
    print '<li><a href="' . $url . '" title="' . $c->description . '">' . $img . $c->name . '</a></li>';
    }
    ?>
    </ul>
    
  33. xSEOn February 2, 2011 at 6:14 pm

    When I tried to use in my category template both:

    do_action( ‘taxonomy_image_plugin_print_image_html’, ‘detail’ );

    and the Category Thumbs script I came up with the following error:

    Fatal error: Call to a member function get_image_html() on a non-object in the following row:

    $img = $taxonomy_images_plugin->get_image_html( ‘detail’, $c->term_taxonomy_id );

    How to avoid it as I need to display a list of the images for the categories I have together with the image of the current category?

  34. Drew February 6, 2011 at 7:13 pm

    can’t seem to get the list to work.. just want to double check that this is proper shortcode to display Post Tags as a list with thumbnails.

    [taxonomy_image_plugin taxonomy="post_tags"]

    Here is my page http://mmafilter.com/fighter-list/

  35. Michael Fields February 6, 2011 at 7:19 pm

    You have:

    taxonomy="post_tags"

    You should try:

    taxonomy="post_tag"

    No “s” on the end.

  36. Drew February 6, 2011 at 8:25 pm

    Awesome worked! thanks so much for the great plugin.

  37. Steve March 9, 2011 at 5:22 pm

    Just to say thank you very much, this does exactly what I needed.

    By the way I *was* about to report a small AJAX problem with it, but that was for the beta version, I’ve just tried the latest version and it’s working now. Thanks again, great job!

  38. Fabio March 14, 2011 at 1:01 am

    What a great plugin. Thank you so much for write it!
    Just a question (request for the future?): do you think it will be possible to implement a way to fill in automatic the “featured image” field by taxonomy?
    My actual theme use this function hardly, but I have a lot of posts that I would to fill automatically with thumbnails by tag. D’you think this will be a good idea for the future?
    Thanks again!
    p.s. sorry for my english ;)

  39. Michael Fields March 14, 2011 at 1:05 am

    Hi Fabio. Glad you found the plugin useful. This feature request is best implemented inside a theme IMO. It is relatively easy to hook into the post_thumbnail functions and override their outputs. I’ll have to give this some thought.

  40. Fabio March 14, 2011 at 1:30 am

    Thank you for your immediate response Michael!
    I don’t really know how to “hack” the post_thumbnail functions in my theme to have a massive and automatic insert of images by tag. Maybe it will be a new function for you great plugin!
    Thanks again!

  41. Movie Bug May 16, 2011 at 7:22 pm

    Hey Michael,

    Nice plugin! I discovered your awesome plugin just now, and I see a lot of potential on my site. Here’s the plugin in action: http://www.filmsteak.com/latest-movie-titles/

    I really hope you can figure out a way to automatically assign a featured image per taxonomy, as what Fabio has requested. I am imagining this scenario: The plugin pulls up the image from the first post that uses the taxonomy term, as the default image. The user can then override the default image, by browsing through the media library.

    Again, thanks for this plugin!

  42. Michael Fields May 16, 2011 at 7:29 pm

    Hi Movie Bug,
    Thanks for your kind words. Glad the plugin is useful. I still think that this functionality is best handled in a theme. I’m still working out the next version of the plugin which will have better API support. I’ll try to work out an example of how this can be done when the new version is ready.

  43. David May 20, 2011 at 3:12 am

    Micheal, great work on this plugin. I’m going to recommend it to go along side of my plugin as it fits in really well. I noticed that when running this in warning mode that I saw a whole bunch of PHP errors showing up. I’ve fixed these in this version of 0.5 which I’m passing off to you: http://pastebin.com/BJa0hFZf

    Line 134: Looks like $this-locale should actually have been $this->locale
    Line 216: Sometimes $q isn’t an object and throws an error. Clumsy work-around on my part.
    Line 347: Fixed the deprecated get_attachment_icon_src
    Line 393, 395: Added post_id=-1 as it was throwing an undefined post_id error

    Great work. Thanks for your contributions to the community.

  44. Michael Fields May 20, 2011 at 8:19 am

    Thanks David! I appreciate you notice fixes! Development of this plugin is on going on Github. Here’s a link: https://github.com/mfields/Taxonomy-Images The next version is much more stable and feature rich. I wouldn’t suggest using it is of yet, but version 0.7 should be ready pretty soon!

  45. Ted Clayton May 29, 2011 at 12:28 am

    When I activate the “Better Plugin Compatibility Control” plugin, the “Taxonomy Images” plugin entry in the Admin Plugins table prints a bunch of text following the plugin version info. Makes the table 50-60 screens wide.

    This text is part of the Homepage Description for “Taxonomy Images”, beginning immediately following the H2 tag that is embedded in the early part of the description (‘live’, with brackets). It prints out with no line-feeds, in duplicate.

    At first glance, it is this live HTML tag in the Description that is triggering something unfortunate in the Admin Plugins table, when the “Better Plugin Compatibility Control” goes about it’s business of adding WP version compatibility info to the Plugins Table.

    I have lots of plugins installed, and this is the only such example of this particular glitch … tho activating “Compatibility” does incite a couple other plugins to generate different kinds of spurious text, on a much smaller scale.

    Interesting concept, to relate Media (images) with Taxonomy terms. I look forward to exploring Taxonomy Images!

  46. Michael Fields May 29, 2011 at 1:28 am

    Hi Ted, You are the second person that has reported such an occurrence. It seems to be an issue with the “Better Plugin Compatibility Control” plugin. I’ve never run into this myself. Are you suggesting that the screenshot link is the culprit? I would rather not remove this link from the description because it showcases how the plugin is intended to be used. I’ll have to test this out and see what happens. Thanks for the info!

  47. Ted Clayton May 29, 2011 at 2:03 am

    Thanks Michael!

    No, I don’t think the screenshot link is doing it.

    The text from the WP Extend Homepage is getting printed in the Plugin Table. Not just the ‘shortie’ Description that is normally present in the right-hand column, but large amounts of the Homepage, verbatim (but without formatting).

    I now have “Better Plugin Compatibility Control” working nicely on my Plugins Table. There are 2 other plugins that ‘glitched’ (less sensationally), and one of those was “Taxonomy Terms LIst”.

    “Advanced Categories” also did an extra line, in his case it is the Donate text & link that shows up.

    There are 550+ plugins installed on this localhost server.

    I can copy-paste the text, or take screenshots … ?

  48. Michael Fields May 29, 2011 at 2:20 am

    I just installed the “Better Plugin Compatibility Control” plugin locally and can see what you are talking about …. very strange indeed. At first glance, it looks like the use of back-ticks is triggering the display to go batty. This is not something that I can easily fix in my readme.txt unfortunately … I believe that the code examples are very important for users and I do not feel like they should be removed. Perhaps the author of “Better Plugin Compatibility Control” could address the readme.txt parsing as there is probably a bug there. Taxonomy Images works perfectly fine both in the Plugin Directory as well as when displayed in /wp-admin/plugins.php. Sorry, but there’s not much I can do here.

  49. Ted Clayton May 29, 2011 at 2:54 am

    Thanks for doing the install Michael.

    No, I don’t advocate for removing the code examples (or any other documentation) from the Readme.txt or the WP Extend page.

    On the contrary, I am heavily prejudiced in favor of plugins & authors who go to the trouble to put up more-robust Extend pages – and maintain their own Homepage too. That’s a big plus for your series of plugins.

    I will see what the “Better Plugin Compatibility Control” plugin author thinks.

  50. Michael Fields May 29, 2011 at 3:10 am

    Awesome! Totally agree. A new version of Taxonomy images + Taxonomy List Shortcode are in the works at the moment, you can follow development on Github if you’re into that kind of a thing. Taxonomy Images currently has much better front-end support as well as better integration with the media uploader. https://github.com/mfields/Taxonomy-Images

  51. Ted Clayton May 29, 2011 at 1:45 pm

    I’m into a range of plugin topics, with categories/taxonomies high on the list. Images are a chronic ‘high-maintainance’ area, for me (could be me..). I toured through the Github page, peeked at the main PHP file. How you grapple with the media integration sounds like a good study-opportunity.

    I left a comment on the “Better Plugin Compatibility Control” webpage yesterday, but this morning I do not see it. I left another.

    I have it up in the editor … it’s short, always a plus for me. Will have a whirl or 2 at how it’s parsing etc, and post any progress back here.

  52. Michael Fields May 30, 2011 at 7:16 am

    Ted, Just wanted to let you know that I got to the bottom of this issue. I would apply the blame to the encoding of my plugin’s readme.txt. I was updating it tonight when I noticed that there were a lot of M^ characters present. Anyway, this will be fixed in the next version … which is actually almost done!

  53. Oliver Schlöbe May 30, 2011 at 7:59 am

    Hey Michael,

    I’m the author of the “Better Plugin Compatibility Control” plugin Ted mentioned above, and just wanted to let you know that your readme.txt doesn’t have any line breaks when I saw that you’ll be addressing it in your next version already. A good Monday morning lol. :)

  54. Ted Clayton May 30, 2011 at 1:23 pm

    Michael,

    This is great news! Thank you for digging in & chasing after this issue … I know that you have lots of things pressing for your attention. It really is a confidence & morale booster, to see this kind of ability & willingness, on the part of those who support the WordPress resource.

    I am writting up articles for the plugins that I investigate & use, and will have my site online in the near future. Categories, taxonomies and their derivative applications are a top interest of mine. Your collection of taxonomy-related plugins are a priority study & writting subject.

    I look forward to the updated “Taxonomy Images”, and will install, test and report back when it is released.

  55. Michael Fields May 31, 2011 at 3:34 am

    Thanks for the follow up. I’ve noticed, since using git more, that my old text editor butchered a few files in my projects – not sure why to tell you the truth. Glad to get to the bottom of this one! Someone else reported it a while back, but did not mention that they had your plugin installed as well… I was never able to reproduce the error. Question: Why do you use the description from the readme.txt file instead of the one supplied via plugin header in the main plugin file?

  56. Ted Clayton May 31, 2011 at 4:03 am

    Michael (and Oliver),

    I fixed my local Readme.txt for “Taxonomy Images”, and now have it running with “Better Plugin Compatibility Control”, flawlessly. (I later upgraded to the new BPCC, and it tested good again.)

    I did it in Notepad++. Turn on “Show all characters”. The TI readme had all “CR” for EOL. Look at other readmes, and they all have “LF” for EOL. It’s a bit tricky to copy-paste these non-printing characters: hold-select from in front of the character-symbol, and then go down to the beginning of the next line: release, click Copy. Paste in the Search dialog. Search & Replace CR with LF (you only see little box place-holders in the input).

  57. Runy June 16, 2011 at 7:05 am

    Is there a chance for localization files?

  58. Michael Fields June 16, 2011 at 7:10 am

    @Runy – yep, that should be pretty easy to do. I believe all text is currently being filtered through gettext functions. I’ll just need to do a line-by-line to catch any errors/omissions and then I’ll include a POT with the next release … should be able to do this in a few days.

  59. Runy June 16, 2011 at 7:17 am

    Great! You can count on Polish translation ;)

  60. xSEOn June 16, 2011 at 7:25 am

    Great plugin! I noticed one problem though: when you try to remove a picture using the “-” button bellow the image it doesn’t do it. In order to remove the image, I click the image, find it within the lists of all of my files, then click “Show” and just there click “Remove association with this term”. I tested it with most browsers with the same result.

  61. Michael Fields June 20, 2011 at 3:33 pm

    @xSEOn … Hmmm, Really weird that I screwed that up! But apparently I did. This will be fixed in version 0.7.3 … thanks for letting me know :)

  62. Michael Fields June 20, 2011 at 3:34 pm

    Runy, A polish translation would rock! Can’t wait :)

  63. Daniele June 30, 2011 at 2:07 pm

    Hi!
    How can i display empty categories with this query?
    Thanks for ur great work!
    d

    $terms = apply_filters( 'taxonomy-images-get-terms', '' );
    
  64. Michael Fields June 30, 2011 at 2:48 pm

    You should be able to pass a ‘term_args’ paramater to the optional third parameter of apply_filters(). This should be an array and the values you can use are listed in the Codex.

    Something like:

    $terms = apply_filters( 'taxonomy-images-get-terms', '', array(
        'term_args' => array(
            'hide_empty' => false
        )
    ) );
    

    might work for you.

  65. Daniele June 30, 2011 at 3:03 pm

    I got a blank page if i replace my code with urs :(

  66. Michael Fields June 30, 2011 at 3:27 pm

    Works for me so does this:

    $terms = apply_filters( 'taxonomy-images-get-terms', '', array(
        'term_args' => array(
            'get' => 'all'
        )
    ) );
    
  67. Daniele June 30, 2011 at 3:41 pm

    works perfectly now :)
    thanks a lot!

  68. Jade August 5, 2011 at 1:55 am

    Really great plugin. I have loved using it in the past. Recently, I upgraded to WordPress 3.2.1 and now the “Images” column in the admin, to add thumbnails to categories, is gone. I have tried both the most recent version of your plugin, as well as 0.5. None of them seem to work with WP 3.2.1. Is this a known issue? Anyways, thanks for creating this plugin.

  69. David August 5, 2011 at 10:15 pm

    Jade, I had the same problem and solved it by going to Settings > Taxonomy Images and checking my taxonomy again. It had gotten unchecked at some point. Once I did that, I now see the column correctly again.

  70. Groove August 7, 2011 at 7:42 pm

    Hi Michael,

    This is an awesome plugin. Thanks a lot!
    I have a question though, I can’t get the following to work:
    At the end of each post, I have the tags presented as text URLs. What I wanted to do is assign an img to every tag, so that the image will display to the left of each tag.
    Basically, something like this: [img1] tag1, [img2] tag2, [img3] tag3… and so on.
    I have tried doing something with:

    <?php print apply_filters( 'taxonomy-images-list-the-terms', '', array(
      'taxonomy'     => 'post_tag',  ) ); ?>

    But this just displays all imgs of the tags one after another.

    Your help is greatly appreciated!! :)

  71. Michael Fields August 7, 2011 at 7:56 pm

    Hi Groove,
    You’ll need to roll your own here. There is another filter that I forgot/didn’t add to the readme.txt docs called ‘taxonomy-images-get-the-terms’. The documentation can be viewed on in the source. This filter is basically a wrapper for WordPress core function get_the_terms(). Please let me know if this helps.

  72. Rein August 27, 2011 at 1:25 pm

    Thanks, just what i needed, a simple way to attach images to a taxonomy and list them!

  73. Richard August 31, 2011 at 8:42 pm

    i needed to be able to call the taxonomy image at will by the taxonomy id. the function taxonomy_image_plugin_get_image_src seemed to be what i needed, but i kept getting an error saying that wp_update_attachment_metadata was not a valid function. i added the following line of code at line 184 in taxonomy-images.php and it fixed it.

    			require ( ABSPATH . 'wp-admin/includes/image.php' );

    weird thing is that i then removed the line and it kept working correctly – i have no idea why but in case anyone else is having a similar issue

  74. Michael Fields August 31, 2011 at 8:59 pm

    taxonomy_image_plugin_get_image_src() is a private function and should not be used in themes. I can provide a new filter in the next version to enable such functionality.

  75. Richard August 31, 2011 at 9:03 pm

    that would be awesome.

    i basically had to create two new custom functions to get what i needed that were modified versions of taxonomy_image_url and taxonomy_image_plugin_get_image_src so that i could get the thumbnail version of the image associated with the taxonomy using the taxonomy id

  76. Rein September 2, 2011 at 12:41 pm

    Hi Michael, is responded on a question I saw in the WP forums.. could you help me out with that? Topic is over here: http://wordpress.org/support/topic/plugin-taxonomy-images-warning-missing-argument-2-for-taxonomy_images_plugin_list_the_terms?replies=4

  77. Rein September 7, 2011 at 3:30 pm

    Can someone help me out? I like to show the category image on the archive page. For each post the images attached to the category’s (taxonomy).

  78. Miguel Vaca October 11, 2011 at 7:21 pm

    It doesn’t work withe latest version of WP

  79. Michael Fields October 11, 2011 at 7:24 pm

    Miguel, Which version of WordPress? I have fully tested on 3.2 and have experienced no errors. I do plugin testing very, very late in the WordPress development cycle. That being said, this plugin has not been tested with any version of 3.3. If you are experiencing issues in 3.3, please submit a detailed bug report here. Thanks!

  80. David October 11, 2011 at 9:59 pm

    FWIW, I just tested this in WP 3.3 beta 1 and didn’t have any trouble. The interface is a little different because of the changes to the uploader, but it works just fine for me.

  81. Dan October 18, 2011 at 6:25 pm

    If I know the term ID, can I return the image for that term?

  82. Dan October 25, 2011 at 9:06 pm

    So I’m guessing I can’t get the image knowing the term id?

  83. Jen October 28, 2011 at 12:56 pm

    Just wanted to say thanks for a great plugin. This plugin solves a world of client requests. Here’s my latest use of it: http://pizzazzerie.com/topics/ which combines taxonomy-images-get-terms with wp_list_categories.

  84. jcnv November 6, 2011 at 1:33 am

    Is there a way to display a taxonomy image of a given size while also wrapping the image in an anchor tag that leads users to the image’s full size?

  85. Jay January 17, 2012 at 8:35 pm

    print apply_filters does not work for me. I have to use do_action. I don’t get it.

    Plugin is awesome by the way. Thanks!

  86. Ruben January 19, 2012 at 1:05 pm

    Sorry but i can get this plugin to work…absolutly no output.

    i use the plugin + this code and hooked it in place after loop:

    print apply_filters( 'taxonomy-images-list-the-terms', '', array( 'image_size' => 'detail', 'taxonomy' => 'company', 'after' => '</div>', 'after_image' => '</span>', 'before' => '<div>', 'before_image' => '<span>', ) );

    could you help me to figure it out?

  87. Brad Williams February 10, 2012 at 2:20 pm

    For anyone wanting to display an image for a taxonomy using the taxonomy ID, here is a good solution:

    http://wordpress.org/support/topic/plugin-taxonomy-images-get-image-on-single-page#post-2613328

  88. chrismccoy November 23, 2012 at 4:27 pm

    which should i be using to get all category images, one for each category for an archive page so each image links to a category?

Fork me on GitHub