Skip to content
Site Under Re-Design: We're updating & improving the docs! Some layouts or content may look broken or inconsistent during this process. If you’re unable to find an article, please use the search bar while we restructure and optimize the sidebar navigation.

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)
Related Snippets
Back To Top