Title: Taxonomy Images
Author: Ben Huson
Published: <strong>14. februara 2010</strong>
Last modified: 15. februara 2024

---

Tykače pytać

![](https://ps.w.org/taxonomy-images/assets/banner-772x250.png?rev=1288553)

Tutón tykač **njeje so z najnowšimi 3 hłownymi wersijemi WordPress testował**. Snano
so hižo njewothladuje abo njepodpěruje a ma problemy z kompatibelnosću, hdyž so 
z nowšimi wersijemi WordPress wužiwa.

![](https://ps.w.org/taxonomy-images/assets/icon-256x256.png?rev=1283547)

# Taxonomy Images

 Wot [Ben Huson](https://profiles.wordpress.org/husobj/)

[Sćahnyć](https://downloads.wordpress.org/plugin/taxonomy-images.1.0.zip)

 * [Podrobnosće](https://hsb.wordpress.org/plugins/taxonomy-images/#description)
 * [Pohódnoćenja](https://hsb.wordpress.org/plugins/taxonomy-images/#reviews)
 *  [Instalacija](https://hsb.wordpress.org/plugins/taxonomy-images/#installation)
 * [Wuwiće](https://hsb.wordpress.org/plugins/taxonomy-images/#developers)

 [Podpěra](https://wordpress.org/support/plugin/taxonomy-images/)

## Wopisanje

#### 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](https://codex.wordpress.org/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 passing
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(
        '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">',
        'after'      => '</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 the images associated with
all of the terms associated with the post. 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 tag.
 * **after_image** _(string)_ – Text to append to each image. Default value is a
   closing list-item tag.
 * **before** _(string)_ – Text to prepend to the output. Default value is an open
   unordered list tag 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 tag.
 * **image_size** _(string)_ – Any registered image size. Values will vary from 
   installation to installation. Image sizes defined in core include: „thumbnail“,„
   medium“ and „large“. „full“ 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(
        'before'       => '<div class="my-custom-class-name">',
        'after'        => '</div>',
        'before_image' => '<span>',
        'after_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()](https://codex.wordpress.org/Function_Reference/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 associated images will 
   be queried 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()`](https://codex.wordpress.org/Function_Reference/get_terms)
   as the second parameter. Default value is an empty array.

Here’s an example of a simple custom loop that you can use 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' ) . '</a></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](https://wordpress.org/tags/taxonomy-images?forum_id=10#postform).
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](https://github.com/benhuson/Taxonomy-Images).
If you find a bug in this plugin or have a suggestion to make it better, please 
[create a new issue](https://github.com/benhuson/Taxonomy-Images/issues/new)

#### 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 [plugin homepage](https://wordpress.org/plugins/taxonomy-images/).
 * **Let me know if it works** – Use the _Compatibility_ widget on the [plugin homepage](https://wordpress.org/plugins/taxonomy-images/)
   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](http://bit.ly/taxonomy-images)
 * **Are you a writer?** Help promote by writing an article on your website about
   this plugin.

#### Need More Taxonomy Plugins?

The original author of this plugin, Michael Fields, released a handful of plugins
dealing with taxonomies. Please see his [WordPress.org profile](https://profiles.wordpress.org/mfields/)
for more information.

## Fota wobrazowki

 * [[
 * Edit terms admin page.
 * [[
 * Edit term admin page.
 * [[
 * Media Modal

## Instalacija

 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.

## Pohódnoćenja

![](https://secure.gravatar.com/avatar/7f8e5e7b37c196517e868966c352253249b2fb7581602f6df897588b81c9e227?
s=60&d=retro&r=g)

### 󠀁[Continues to work (WP 5.7.2)](https://wordpress.org/support/topic/continues-to-work-wp-5-7-2/)󠁿

 [](https://profiles.wordpress.org/three_star_dave/) 29. junija 2021

I could wish for a bit more sophistication in the front-end interface — the documentation
hints at a raft of options — but I’ve had it working for years now, and it keeps
on ticking.

![](https://secure.gravatar.com/avatar/b382bcf0dcb8789f25830744642416830ada9527ee26aaee04a00333703250e1?
s=60&d=retro&r=g)

### 󠀁[Very useful plugin](https://wordpress.org/support/topic/very-useful-plugin-855/)󠁿

 [Mladen Gradev](https://profiles.wordpress.org/joe8104/) 14. oktobra 2019

Thank you! Works great and have a lot of options.

![](https://secure.gravatar.com/avatar/74fb66f167c47ff9ae5cb579ed613c7254b40720a3a63e606638b0a0e894c5ec?
s=60&d=retro&r=g)

### 󠀁[Great!](https://wordpress.org/support/topic/great-10222/)󠁿

 [cabowm02](https://profiles.wordpress.org/cabowm02/) 28. septembra 2019

Works as described! I can display multiple images if I select multiple categories
for a post, but I can also still display only one image for an archive category 
and not have issues with other images being displayed for posts within that category
assigned if I’m on a specific category page. I’m still trying to figure out how 
to get alt or title of image to display though.

![](https://secure.gravatar.com/avatar/c2dd479beeb0893f6d6ba80735fcf6f48728fa844e7a78367e6e1ad673a915be?
s=60&d=retro&r=g)

### 󠀁[Display loop image category](https://wordpress.org/support/topic/display-loop-image-category/)󠁿

 [yandarma](https://profiles.wordpress.org/yandarma/) 30. awgusta 2019

Hi, I’m new in wordpress, how to call image in Loop category display ?

![](https://secure.gravatar.com/avatar/67276c935f576b394ae1e3782ffd3b7154a2867d31645cfc9b1ea3dca59b696d?
s=60&d=retro&r=g)

### 󠀁[Great Plugin](https://wordpress.org/support/topic/great-plugin-17505/)󠁿

 [iwtravelllc](https://profiles.wordpress.org/iwtravelllc/) 6. apryla 2018

Works as expected. Thank you.

![](https://secure.gravatar.com/avatar/9d9907899eb6de804a62f7606f4dcdfb36bdf8e3f7e5bff21e93627af4946138?
s=60&d=retro&r=g)

### 󠀁[Great Plugin](https://wordpress.org/support/topic/great-plugin-15348/)󠁿

 [Petersen](https://profiles.wordpress.org/wpguru6/) 30. septembra 2017

I love this plugin.

 [ Čitajće 40 pohódnoćenjow ](https://wordpress.org/support/plugin/taxonomy-images/reviews/)

## Sobuskutkowarjo a wuwiwarjo

„Taxonomy Images“ je softwara wotewrjeneho žórła. Slědowacy ludźo su k tutomu tykačej
přinošowali.

Sobuskutkowarjo

 *   [ Ben Huson ](https://profiles.wordpress.org/husobj/)
 *   [ Michael Fields ](https://profiles.wordpress.org/mfields/)
 *   [ Jamie McHale ](https://profiles.wordpress.org/jamiemchale/)

[Přełožće „Taxonomy Images“ do swojeje rěče.](https://translate.wordpress.org/projects/wp-plugins/taxonomy-images)

### Na wuwiću zajimowany?

[Přehladajće kod](https://plugins.trac.wordpress.org/browser/taxonomy-images/), 
hladajće do [SVN-repozitorija](https://plugins.svn.wordpress.org/taxonomy-images/)
abo abonujće [wuwiwanski protokol](https://plugins.trac.wordpress.org/log/taxonomy-images/)
přez [RSS](https://plugins.trac.wordpress.org/log/taxonomy-images/?limit=100&mode=stop_on_copy&format=rss).

## Protokol změnow

#### Unreleased

#### 1.0

 * **BUGFIX:** Fixed full image size sometimes not being returned.
 * **UPDATE:** Control, blank and default images moves to `images` folder.
 * **UPDATE:** Prepare plugin structure for term meta compatibility.

#### 0.9.7

 * **UPDATE:** Remove use of deprecated `image_resize` function.
 * **UPDATE:** Bump minimum WordPress version to 3.5.

#### 0.9.6

 * **BUGFIX:** Fix issue where if no terms have images but ‚having_images‘ is false,
   nothing would be returned (props Matt).

#### 0.9.5

 * **BUGFIX:** Fix loading of admin stylesheet when editing terms in WordPress 4.5

#### 0.9.4

 * **BUGFIX:** Fix for taxonomy names that may contain characters other than lowercase
   and underscores (e.g. uppercase).

#### 0.9.3

 * **BUGFIX:** Fix post permissions error when using media modal.

#### 0.9.2

 * **BUGFIX:** Fix old and new media modal opening simultaneously in some circumstances.
 * **UPDATE:** Documentation: Pedantic corrections. Props [Gary Jones](https://profiles.wordpress.org/garyj)
 * **UPDATE:** Added CHANGELOG.md file.

#### 0.9.1

 * **BUGFIX:** Fixes media modal not opening on newly created terms.
 * **UPDATE:** Adhere to WordPress PHP coding standards.

#### 0.9

 * **COMPAT:** Add support for WordPress 3.5+ media modal.
 * **COMPAT:** Confirmed minimum WordPress 3.4 required.
 * **UPDATE:** Add Spanish translation.
 * **UPDATE:** Make images retina sized in the admin.
 * **UPDATE:** Re-color admin image and icons to fit with more recent versions of
   WordPress.
 * **UPDATE:** Stop using deprecated `image_resize()` function.
 * **UPDATE:** Stop using deprecated `screen_icon()` function.
 * **UPDATE:** Move JavaScript and CSS files to subfolders.
 * **UPDATE:** Added screenshots for WordPress.org
 * **UPDATE:** Add husobj as a contributor.

#### 0.8.0

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

#### 0.7.3

 * **BUGFIX:** Fixed the delete image button on edit-terms.php.
 * **UPDATE:** Better escaping.
 * **UPDATE:** Introduced `.pot` file and languages directory.

#### 0.7.2

 * **UPDATE:** Return data for fullsize images in archive views. [See this thread](https://wordpress.org/support/topic/image-size-full).

#### 0.7.1

 * **BUGFIX:** Remove unused link code which is throwing an error when no taxonomies
   support images.

#### 0.7

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

#### 0.6

 * **UPDATE:** Completely recoded.
 * Never released.

#### 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:** Obsessive 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](https://wordpress.org/support/profile/jaygoldman).

#### 0.4.3

 * **COMPAT:** Removed use of deprecated function `is_taxonomy()` – props to [anointed](https://profiles.wordpress.org/users/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.
 * **UPDATE:** Support for WordPress 3.0 has been added. Support for all beta versions
   of 3.0 has been dropped.

#### 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

 * **BUGFIX:** Deleted the `register_deactivation_hook()` function – sorry to all
   8 who downloaded this plugin so far 🙂
 * **COMPAT:** Changed the firing order of every hook utilizing the `category_rows`
   method to 15. This allows this plugin to be compatible with [Reveal IDs for WP Admin](https://wordpress.org/plugins/reveal-ids-for-wp-admin-25/).
   Thanks to [Peter Kahoun](https://profiles.wordpress.org/kahi/)
 * **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()`.

#### 0.2

 * Original Release – Works with WordPress 2.9.1.

## Meta

 *  Version **1.0**
 *  Last updated **2 lěće**
 *  Active installations **10.000+**
 *  WordPress version ** 4.4 abo nowši **
 *  Tested up to **6.4.8**
 *  PHP version ** 5.3 abo nowši **
 *  Language
 * [English (US)](https://wordpress.org/plugins/taxonomy-images/)
 * Tags
 * [category](https://hsb.wordpress.org/plugins/tags/category/)[image](https://hsb.wordpress.org/plugins/tags/image/)
   [tag](https://hsb.wordpress.org/plugins/tags/tag/)[taxonomy](https://hsb.wordpress.org/plugins/tags/taxonomy/)
   [term](https://hsb.wordpress.org/plugins/tags/term/)
 *  [Rozšěrjeny napohlad](https://hsb.wordpress.org/plugins/taxonomy-images/advanced/)

## Pohódnoćenja

 4.4 out of 5 stars.

 *  [  28 5-star reviews     ](https://wordpress.org/support/plugin/taxonomy-images/reviews/?filter=5)
 *  [  5 4-star reviews     ](https://wordpress.org/support/plugin/taxonomy-images/reviews/?filter=4)
 *  [  4 3-star reviews     ](https://wordpress.org/support/plugin/taxonomy-images/reviews/?filter=3)
 *  [  1 2-star review     ](https://wordpress.org/support/plugin/taxonomy-images/reviews/?filter=2)
 *  [  2 1-star reviews     ](https://wordpress.org/support/plugin/taxonomy-images/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/taxonomy-images/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/taxonomy-images/reviews/)

## Sobuskutkowarjo

 *   [ Ben Huson ](https://profiles.wordpress.org/husobj/)
 *   [ Michael Fields ](https://profiles.wordpress.org/mfields/)
 *   [ Jamie McHale ](https://profiles.wordpress.org/jamiemchale/)

## Podpěra

Chceće něšto prajić? Trjebaće pomoc?

 [Forum pomocy pokazać](https://wordpress.org/support/plugin/taxonomy-images/)

## Darić

Chceće dalewuwiwanje tutoho tykača podpěrać?

 [ Za tutón tykač darić ](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QSYTTQZBRKQVE)