Snippets: Display “Secondary” Image For Blog Entry Thumbnail

The Total theme includes a "Secondary Thumbnail" field which is used for the "Image Swap" overlay style when using custom Visual Composer grids. However, you can make use of this field for anything you want! For example you can override the default featured image on your entries like the example below:

add_action( 'wpex_blog_entry_thumbnail_args', function( $args )  {

	// Alter thumbnail ID to display secondary image
	if ( $secondary = get_post_meta( get_the_ID(), 'wpex_secondary_thumbnail', true ) ) {
		$args['attachment'] = $secondary;

	// return args
	return $args;
} );


Snippet Type: PHP

Posted Under: Blog

All PHP snippets should be added via a child theme's functions.php file.