
My friend Denis recently released a new plugin called WPJAM Thumbnail. We all know WordPress has a built-in featured image function — you can set a thumbnail when writing a post and call it using the wp_post_thumbnail function. However, it’s rather cumbersome since every post requires manual setup. WPJAM Thumbnail makes the WordPress thumbnail experience far more convenient. Let me walk you through it.
How WPJAM Thumbnail Determines Thumbnails
The WPJAM Thumbnail plugin searches for a post’s thumbnail in the following order:
- First, it checks if the post has its own featured image set.
- If not, it checks whether the post’s tags have a featured image.
- If not, it checks whether the post contains any images, and grabs the first one.
- If still nothing, it checks whether the post’s category has a featured image.
![]()
This ensures that virtually every post has a thumbnail, and for groups of similar posts, you only need to set it once. For example, for posts under a certain tag, just go to that tag’s edit page and set a featured image (as shown above), and all posts with that tag will have their thumbnails set automatically. Extremely convenient.
WPJAM Thumbnail Image Cropping Methods
- By default, it uses timthumb.php, the best PHP image cropping script, which generates appropriately sized images based on the width and height you provide. You’ll need to make the plugin’s include/cache directory writable.
- If you have the Qiniu Mirror Storage Plugin installed, the plugin will use Qiniu’s API for cropping, performing all thumbnail operations on Qiniu’s CDN for top-tier speed and efficiency. Moreover, if the retrieved thumbnail isn’t from your site, it will save the image locally first, then mirror it to Qiniu.
WPJAM Thumbnail Function API
Since the approach to fetching thumbnails and cropping is entirely different, WPJAM Thumbnail’s function API differs significantly from the default thumbnail functions. The plugin provides a rich set of functions for various scenarios:
wpjam_has_post_thumbnail(): Checks if the current post has a thumbnail. Must be used inside the main loop.wpjam_post_thumbnail($size='thumbnail', $crop=1,$class="wp-post-image"): Outputs the current post’s thumbnail. It takes three parameters:$size— the thumbnail size, which can be a string like thumbnail, medium, large (corresponding to the dimensions defined in WordPress Admin > Settings > Media), or an array like array(150,150).$crop— whether to crop or scale, defaults to crop.$class— the class attribute for the output img tag, defaults to wp-post-image.wpjam_get_post_thumbnail($post=null, $size='thumbnail', $crop=1, $class="wp-post-image"): Gets a post’s thumbnail. Compared to wpjam_post_thumbnail, it has an additional $post parameter. Defaults to null, which uses the global variable — when used in the main loop, this refers to the current post.wpjam_get_post_thumbnail_src($post=null, $size='thumbnail', $crop=1): Gets the URL of the post’s thumbnail after it’s been sized according to specifications.wpjam_get_post_thumbnail_uri($post=null): Gets the post’s original thumbnail URL — the image address before any cropping.
Finally: this is a paid plugin. Purchase here: http://wpjam.net/item/wpjam-thumbnail/