Link the thumbnail to its full image

By default, thumbnail will link to the post.
To link the thumbnail to its full image, please add this code to file functions.php of your active theme:

// Content Views Pro - thumbnail link to its full image
add_filter( 'pt_cv_field_href', 'cvp_theme_thumbnail_link_itself', 100, 2 );
function cvp_theme_thumbnail_link_itself( $href, $post ) {
	$trace = debug_backtrace();	
	if ( !empty($trace[5]['function']) && $trace[5]['function'] === '_field_thumbnail' ) {
		$full_img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
		if ( !empty( $full_img[0] ) ) {
				$href = $full_img[0];
		}
	}

	return $href;
}

Best regards,

Scroll to Top