Working with Term Images

GD Content Tools Pro allows you to set image for each term in selected taxonomies. This feature includes expansion of the terms grid to include an option for selecting the image and set of functions to work with these images.

How to assign images to terms

This video shows how to enable images to terms assignment for taxonomies.

Function for theme templates

To get term image, you need to use function gdcet_get_term_image. This function will return FALSE if the term has no image set. Function format is:

gdcet_get_term_image($term, $taxonomy = '', $size = 'thumbnail', $get = 'img');

The first argument $term is required and this has to be term object, term ID or term slug or name. The second argument $taxonomy can be left empty. Argument $size specifies the size of the image you want to be returned and this is standard WordPress size argument. It can be the name of the image size or array with the width and height. The last argument $get is to specify what output to return: ‘img‘ – full image tag, ‘url‘ – URL for the image and ‘id‘ for image ID.


In all examples, we are working with term with ID 2.

Display image with custom size
echo gdcet_get_term_image(2, '', array(256, 192), 'img');
Display image thumbnail
echo gdcet_get_term_image(2, '', 'thumbnail', 'img');


Rate this article

You are not allowed to rate this post.

Leave a Comment