Show thumbnail without hyperlink (disable link of thumbnail)

Content Views helps you to show post’s thumbnail image easily without coding.
By default, thumbnail is linked to the post.

# Disable thumbnail link for all posts in View

To show thumbnail image without link for a View, please add this code to file functions.php of your active theme:

// Content Views Pro - Show thumbnail without hyperlink
add_filter( 'pt_cv_field_thumbnail_nolink', 'cvp_theme_field_thumbnail_nolink' );
function cvp_theme_field_thumbnail_nolink( $args ) {
	global $pt_cv_id;
	if ( $pt_cv_id === 'VIEW_ID' ) {
		$args = true;
	}

	return $args;
}

(replace VIEW_ID with ID of your View)

# Disable thumbnail link of some posts only

Please add this code to file functions.php of your active theme:

// Content Views Pro - Show thumbnail without hyperlink
add_filter( 'pt_cv_field_thumbnail_nolink', 'cvp_theme_field_thumbnail_nolink_some' );
function cvp_theme_field_thumbnail_nolink_some( $args ) {
	global $pt_cv_id, $post;
	if ( $pt_cv_id === 'VIEW_ID' && in_array( $post->ID, array( 10, 20, 30 ) ) ) {
		$args = true;
	}

	return $args;
}

(replace VIEW_ID with ID of your View; replace 10, 20, 30 with IDs of the posts)

Best regards,

Scroll to Top