Skip to content

Snippet: Custom Post Type Post Thumbnail Arguments (size, alt, schema, style, etc)

/**
 * Alter custom post type thumbnail arguments
 * @see framework/core-functions wpex_get_post_thumbnail() function for a list of all available arguments
 *
 * IMPORTANT: Don't forget to change where it says "YOUR_POST_TYPE_NAME" to your post type name
 */
function my_prefix_cpt_post_thumbnail_arguments( $args ) {
	return array(
		'size'          => 'full',
		'width'         => '900',
		'height'        => '400',
		'crop'          => 'center-center',
		'alt'           => wpex_get_esc_title(),
		'schema_markup' => true,
	);

}
add_filter( 'wpex_YOUR_POST_TYPE_NAME_entry_thumbnail_args', 'my_prefix_cpt_post_thumbnail_arguments' );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top