Featured Image (Thumbnail) Format Icons

In version 4.5.0 of Total we introduced a new function named “Thumbnail Post Format Icons” which you can enable under the main “Theme Panel” (disabled by default). This will display little icons over the featured images for your default post type (blog posts). For example if you have a post set to the video format it will display a little video icon over the image.

Example result: 

Developer Usage

As a developer you probably already know Total is always coded with you in mind! There are built-in filters you can use to add format support to 3rd party post types as well as to customize the icons. Below are 2 helpful snippets:

// Enable icons for custom post type
add_filter( 'wpex_thumbnails_have_format_icons', function ( $enabled ) {
	if ( 'portfolio' == get_post_type() ) {
		$enabled = true;
	}
	return $enabled;
} );
// Customize format class
add_filter( 'wpex_get_thumbnail_format_icon_class', function ( $class ) {
	
	// Add video class for portfolio items with the tag "video"
	if ( 'portfolio' == get_post_type() && has_term( 'video', 'portfolio_tag' ) ) {
		$class = 'fa fa-play';
	}

	// Return class
	return $class;

} );