Skip to content

Snippet: Custom Search Results Thumbnail Cropping

/* Sample function showing how to edit the search results featured image
 *
 * IMPORTANT: If your theme is up to date you can modify the search results image size via
 * the settings at Theme Panel > Image Sizes
 * 
 * Accepted params: width, height, crop, alt, size, attachment
 * @see framework/core-functions.php wpex_post_thumbnail() function
 */
function myprefix_wpex_search_thumbnail_args( $args ) {
	$args['width']  = '500'; // Edit accordingly
	$args['height'] = '500'; // Edit accordingly
	return $args;
}
add_filter( 'wpex_search_thumbnail_args', 'myprefix_wpex_search_thumbnail_args' );
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