Show custom field as thumbnail of post

With Content Views Pro, you can display WordPress featured image, or image inside post content as thumbnail of post easily without coding.
If you have an image custom field, and want to show that custom field as thumbnail, please add this code to file functions.php of your active theme:

// CVPro - Use custom field as thumbnail
add_filter( 'pt_cv_field_content_excerpt', 'cvp_theme_custom_field_as_thumbnail', 100, 3 );
function cvp_theme_custom_field_as_thumbnail( $args, $fargs, $post ) {	
	if ( empty( $fargs ) ) {
		$meta = get_post_meta( $post->ID );

		$custom_img = !empty( $meta[ 'CUSTOM_FIELD_NAME' ][ 0 ] ) ? $meta[ 'CUSTOM_FIELD_NAME' ][ 0 ] : '';
		if ( !empty( $custom_img ) ) {
			$args = sprintf( '<img src="%s">', $custom_img );
		}
	}

	return $args;
}

Please replace CUSTOM_FIELD_NAME with name of your custom field.

Notice: If you created custom field with Toolset plugin, you may need to add prefix wpcf-. For example, you created a custom field post-image with Toolset plugin, then the value of CUSTOM_FIELD_NAME should be wpcf-post-image.

Best regards,