Title: Taxonomy Thumbnail
Author: Grégory Viguier
Published: <strong>15.06.2015</strong>
Last modified: 30.05.2016

---

Поиск плагинов

![](https://ps.w.org/sf-taxonomy-thumbnail/assets/banner-772x250.jpg?rev=1286672)

Этот плагин **не тестировался с последними 3 основными выпусками WordPress**. Скорее
всего, он уже не поддерживается и может быть несовместим с текущими версиями WordPress.

![](https://ps.w.org/sf-taxonomy-thumbnail/assets/icon.svg?rev=1181360)

# Taxonomy Thumbnail

 Автор: [Grégory Viguier](https://profiles.wordpress.org/greglone/)

[Скачать](https://downloads.wordpress.org/plugin/sf-taxonomy-thumbnail.zip)

 * [Детали](https://ru.wordpress.org/plugins/sf-taxonomy-thumbnail/#description)
 * [Отзывы](https://ru.wordpress.org/plugins/sf-taxonomy-thumbnail/#reviews)
 *  [Установка](https://ru.wordpress.org/plugins/sf-taxonomy-thumbnail/#installation)
 * [Разработка](https://ru.wordpress.org/plugins/sf-taxonomy-thumbnail/#developers)

 [Поддержка](https://wordpress.org/support/plugin/sf-taxonomy-thumbnail/)

## Описание

This plugin is meant for developers, it allows to attach a thumbnail to taxonomy
terms.

#### Пользовательский интерфейс для настройки миниатюр

The thumbnail can be added on term creation or later on the term edition page.
 
The terms list has a column displaying the current thumbnail (so far, no specific
action here). The plugin uses the «new» media window (the one used since WP 3.5),
not the old thickbox. I made some extra efforts to enhance accessibility. I’m not
an a11y expert but the UI is not only a «Add thumbnail» button. For instance, the
new `wp.a11y.speak()` is used when available. Please give me feedback if you think
it can be improved. Works with or without JavaScript. If JavaScript is enabled, 
thumbnails are set via ajax in the term edition window, no need to update the term.
By default, the UI is displayed for all public taxonomies, but this can be filtered
that way:

    ```
    add_filter( 'sftth_taxonomies', 'my_taxonomies_with_thumbnail' );

    function my_taxonomies_with_thumbnail( $taxonomies ) {
        unset( $taxonomies['post_tag'] );
        $taxonomies['my_custom_tax'] = 'my_custom_tax';
        return $taxonomies;
    }
    ```

#### Теги шаблона

Find them in `inc/template-tags.php`.
 **Important note: for WP 4.4+, these functions
use `term_id`. For WP < 4.4, they use `term_taxonomy_id`.** I tried to mimic the
post thumbnail functions:

 1. `get_term_thumbnail_id( $term_id )`: Retrieve term thumbnail ID.
 2. `has_term_thumbnail( $term_id )`: Check if a term has a thumbnail attached to it.
 3. `the_term_thumbnail( $term_id, $size = 'post-thumbnail', $attr = '' )`: Display
    the term thumbnail.
 4. `get_term_thumbnail( $term_id, $size = 'post-thumbnail', $attr = '' )`: Retrieve
    the term thumbnail.
 5. `set_term_thumbnail( $term_id, $thumbnail_id )`: Set a term thumbnail.
 6. `delete_term_thumbnail( $term_id )`: Detach a thumbnail from a term.

#### Store the data

From WordPress 4.4, the term metas API is used.
 Below WordPress 4.4, there are 
two ways to store the thumbnail IDs:

 1. Use term metas with the plugin [Meta for Taxonomies](https://wordpress.org/plugins/meta-for-taxonomies/).
 2. Use an option (an array association of `term_taxonomy_id` => `thumbnail_id` integers).
    The option name can be customized by defining the constant `SFTTH_OPTION_NAME` 
    in `wp-config.php`.

#### Get terms

Use `get_terms()` with a specific parameter to retrieve only terms with a thumbnail:

    ```
    $terms = get_terms( array(
        'with_thumbnail' => true,
    ) );
    ```

From WordPress 4.4, you can also use a small helper to build your meta query:

    ```
    $terms = get_terms( array(
        'meta_query' => array(
            'relation' => 'AND',
            array(
                // Any meta query.
            ),
            sftth_meta_query(),
        ),
    ) );
    ```

Below WordPress 4.4, if you use the plugin _Meta for Taxonomies_, you should always
cache thumbnails.
 When using `'with_thumbnail' => false` you will retrieve all 
terms, even those without a thumbnail, but the thumbnails will be cached, saving
calls to the database later:

    ```
    $terms = get_terms( array(
        'with_thumbnail' => false,
    ) );
    ```

#### Деинсталлировать

When uninstalling the plugin, you can decide to not delete the thumbnails, simply
define a constant in `wp-config.php`:

    ```
    define( 'SFTTH_KEEP_DATA', true );
    ```

#### Переводы

 * US English
 * French

#### Требования

Should work starting from WP 3.5, but tested only in WP 4.2.2+ so far.

#### Credits

Photo used for the banner by [Nicolas Janik](https://www.flickr.com/photos/n1colas/2598073727/)(
[CC BY 2.0](https://creativecommons.org/licenses/by/2.0/)).

## Скриншоты

[⌊Create a new category an assign a thumbnail.⌉⌊Create a new category an assign 
a thumbnail.⌉[

Create a new category an assign a thumbnail.

[⌊Change or remove the thumbnail from the category.⌉⌊Change or remove the thumbnail
from the category.⌉[

Change or remove the thumbnail from the category.

## Установка

 1. Extract the plugin folder from the downloaded ZIP file.
 2. Upload the `sf-taxonomy-thumbnail` folder to your `/wp-content/plugins/` directory.
 3. Activate the plugin from the «Plugins» page.
 4. Below WordPress 4.4, if you want to use term metas instead of an option, install
    the plugin [Meta for Taxonomies](https://wordpress.org/plugins/meta-for-taxonomies/).

## Часто задаваемые вопросы

  Why should I use the plugin *Meta for Taxonomies*?

If you use WordPress 4.4 or greater you don’t need to.
 Otherwise, I think it’s 
the proper way to store this kind of data. Post thumbnails are stored in post metas,
right? So term thumbnails should be stored in term metas. But it requires a plugin,
WordPress does not provide a term metas system before 4.4. On the other hand, I 
don’t want to force you to use a dependency, so I wanted my plugin to also work 
without it.

  Any plan for a settings page where I can choose the taxonomies?

Nope, it will not happen, imho there is no point to do so.

  Other questions?

Eventually, try the [WordPress support forum](https://wordpress.org/support/plugin/sf-taxonomy-thumbnail).

## Отзывы

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

### 󠀁[It works in WordPress 5+](https://wordpress.org/support/topic/it-works-in-wordpress-5/)󠁿

 [Jennifer Eileen](https://profiles.wordpress.org/jennifer-ayline/) 06.01.2020

It works in Wordpress 5+

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

### 󠀁[Work With My Custom RESTful API](https://wordpress.org/support/topic/work-with-my-custom-restful-api/)󠁿

 [rahadur](https://profiles.wordpress.org/rahadur/) 21.03.2019

Life saver plugins for me. I am new in WordPress REST API development & Plugin development.
+10 for support all of my Custom Terms automatically. It will be great for this 
plugins that it return media attachment url instead return html. Thank You.

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

### 󠀁[Excellent!](https://wordpress.org/support/topic/excellent-4999/)󠁿

 [wpSpade](https://profiles.wordpress.org/wpspade/) 09.06.2017

Cool work! Actually, I include it to suggested plugins selection for every my theme
🙂

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

### 󠀁[I needed that, it existed.](https://wordpress.org/support/topic/i-needed-that-it-existed/)󠁿

 [Julio Potier](https://profiles.wordpress.org/juliobox/) 09.02.2017

So easy to use, writing this review takes longer than using and understanding the
plugin. *****

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

### 󠀁[Sweet](https://wordpress.org/support/topic/sweet-74/)󠁿

 [chomachomachoma](https://profiles.wordpress.org/chomachomachoma/) 03.09.2016

Allows developers to easily extend thumb functionality for custom post types and
custom taxonomies. Lots of great options, easy to work with, and good documentation.
Thanks!

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

### 󠀁[Perfect](https://wordpress.org/support/topic/perfect-2934/)󠁿

 [bphosseini](https://profiles.wordpress.org/bphosseini/) 03.09.2016

Thanks.

 [ Посмотреть все 11 отзывов ](https://wordpress.org/support/plugin/sf-taxonomy-thumbnail/reviews/)

## Участники и разработчики

«Taxonomy Thumbnail» — проект с открытым исходным кодом. В развитие плагина внесли
свой вклад следующие участники:

Участники

 *   [ Grégory Viguier ](https://profiles.wordpress.org/greglone/)

«Taxonomy Thumbnail» переведён на 4 языка. Благодарим [переводчиков](https://translate.wordpress.org/projects/wp-plugins/sf-taxonomy-thumbnail/contributors)
за их работу.

[Перевести «Taxonomy Thumbnail» на ваш язык.](https://translate.wordpress.org/projects/wp-plugins/sf-taxonomy-thumbnail)

### Заинтересованы в разработке?

[Посмотрите код](https://plugins.trac.wordpress.org/browser/sf-taxonomy-thumbnail/),
проверьте [SVN репозиторий](https://plugins.svn.wordpress.org/sf-taxonomy-thumbnail/),
или подпишитесь на [журнал разработки](https://plugins.trac.wordpress.org/log/sf-taxonomy-thumbnail/)
по [RSS](https://plugins.trac.wordpress.org/log/sf-taxonomy-thumbnail/?limit=100&mode=stop_on_copy&format=rss).

## Журнал изменений

#### 1.3

 * 2016/05/30
 * The plugin now works with svg files (using svg files require an adequate plugin).
 * Улучшена документация по коду.

#### 1.2.2

 * 2016/05/30
 * Fixed a bug that prevented the use of SVG as thumbnail.

#### 1.2.1

 * 2016/01/31
 * Bugfix in uninstallation process: term metas wouldn’t be deleted with the new
   WordPress API. Props Ghislain Phu.

#### 1.2

 * 2015/11/01
 * Ready for WordPress 4.4: the plugin will use the new term metas API and will 
   no longer use _Meta for Taxonomies_ plugin. **Developers, be aware that with 
   WP 4.4+ the template tags do not use `term_taxonomy_id` anymore, but `term_id`
   instead.**
 * Migrate to WordPress 4.4: when the site is updated to WP 4.4, the plugin automatically
   migrate the old data (stored in an option or by _Meta for Taxonomies_) to the
   new term metas table, convert `term_taxonomy_id`s into `term_id`s, and delete
   old data (only the plugin data of course). Then if you used _Meta for Taxonomies_,
   it can be uninstalled afterward. **Side note: in case _Meta for Taxonomies_ is
   not updated by then, you should deactivate it BEFORE updating to WordPress 4.4(
   it is not compatible with WP 4.4 yet, and will trigger a fatal error).**
 * New: when an image attachment is trashed or deleted, the related meta is also
   removed.
 * Lots of docs have been added or updated.
 * It’s a bit late now but there are new tools to migrate data between option and
   _Meta for Taxonomies_. See `inc/migrate.php`.

#### 1.1

 * 2015/09/20
 * Move the thumbnail column after the term name. Since WP 4.3 there is a concept
   of _primary column_: if the thumbnail is not displayed AFTER this primary column(
   the term name), it will break the row layout on screens < 782px.
 * Code cleanup.

#### 1.0

 * 2015/06/11
 * Первая версия.

## Мета

 *  Версия **1.3**
 *  Обновление: **10 лет назад**
 *  Активных установок: **3 000+**
 *  Версия WordPress ** 3.5 или выше **
 *  Совместим вплоть до: **4.5.33**
 *  Языки
 * [English (US)](https://wordpress.org/plugins/sf-taxonomy-thumbnail/), [French (France)](https://fr.wordpress.org/plugins/sf-taxonomy-thumbnail/),
   [Italian](https://it.wordpress.org/plugins/sf-taxonomy-thumbnail/), [Japanese](https://ja.wordpress.org/plugins/sf-taxonomy-thumbnail/)
   и [Russian](https://ru.wordpress.org/plugins/sf-taxonomy-thumbnail/).
 *  [Перевести на ваш язык](https://translate.wordpress.org/projects/wp-plugins/sf-taxonomy-thumbnail)
 * Метки:
 * [category](https://ru.wordpress.org/plugins/tags/category/)[dev](https://ru.wordpress.org/plugins/tags/dev/)
   [image](https://ru.wordpress.org/plugins/tags/image/)[taxonomy](https://ru.wordpress.org/plugins/tags/taxonomy/)
   [thumbnail](https://ru.wordpress.org/plugins/tags/thumbnail/)
 *  [Дополнительно](https://ru.wordpress.org/plugins/sf-taxonomy-thumbnail/advanced/)

## Оценки

 5 из 5 звёзд.

 *  [  10 5-звездный отзыв     ](https://wordpress.org/support/plugin/sf-taxonomy-thumbnail/reviews/?filter=5)
 *  [  0 4-звездный отзыв     ](https://wordpress.org/support/plugin/sf-taxonomy-thumbnail/reviews/?filter=4)
 *  [  0 3-звездный отзыв     ](https://wordpress.org/support/plugin/sf-taxonomy-thumbnail/reviews/?filter=3)
 *  [  0 2-звездный отзыв     ](https://wordpress.org/support/plugin/sf-taxonomy-thumbnail/reviews/?filter=2)
 *  [  0 1-звездный отзыв     ](https://wordpress.org/support/plugin/sf-taxonomy-thumbnail/reviews/?filter=1)

[Ваш отзыв](https://wordpress.org/support/plugin/sf-taxonomy-thumbnail/reviews/#new-post)

[Посмотреть всеотзывы](https://wordpress.org/support/plugin/sf-taxonomy-thumbnail/reviews/)

## Участники

 *   [ Grégory Viguier ](https://profiles.wordpress.org/greglone/)

## Поддержка

Есть что сказать? Нужна помощь?

 [Перейти в форум поддержки](https://wordpress.org/support/plugin/sf-taxonomy-thumbnail/)