WPThumbs
Themes Plugins By purpose By industry Best-of lists Fix it guides
Free Plugin by Grégory Viguier v1.3

Taxonomy Thumbnail

Add a thumbnail to your taxonomy terms.

Taxonomy Thumbnail

The facts

Rating
5★ from 10
Active installs
3k+
Price
Free
Last updated
30 May 2016
Added
Jun 2015
Requires WP
3.5
Tested up to
WP 4.5.33
Downloads
52,072

Our analysis

AI-assisted

Taxonomy Thumbnail is a WordPress plugin designed for developers to attach thumbnails to taxonomy terms. It provides a user interface for adding thumbnails during term creation or on the term edition page. The plugin also displays the current thumbnail in the terms list and supports both JavaScript-enabled and non-JavaScript environments.

The plugin enhances accessibility features and uses the media window introduced in WordPress 3.5. It includes template tags for retrieving and displaying term thumbnails, and it stores data using the term metas API for WordPress 4.4 and above, or through alternative methods for earlier versions.

Best for: This plugin is suitable for developers looking to enhance taxonomy term management in WordPress.

What it does well

  • Allows attachment of thumbnails to taxonomy terms
  • User interface for easy thumbnail management
  • Enhances accessibility features
  • Compatible with both JavaScript and non-JavaScript environments
  • Includes template tags for easy integration

Where it falls short

  • Limited information on user feedback and support
  • Last updated in May 2016, may not be compatible with newer WordPress features

Verdict

Taxonomy Thumbnail provides useful functionality for developers managing taxonomy terms, though its age may limit compatibility with the latest WordPress updates.

From the developer

Grégory Viguier's own description of Taxonomy Thumbnail, lightly tidied.

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

UI for setting the thumbnails

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;
}

Template tags

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.
  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:

Read the full description on the official page →

Tagged as