Reply To: Frontier Child Theme functions.php problem (thumbnail size)

#4707
Ron
Keymaster

The code you’ve added only instructs WordPress to add a new size whenever an image is uploaded. You’ll need 2 functions, one to add the new image size and another to get the theme to use the new image size for the thumbnails on the excerpts.

Add new image size

function frontier_new_image_size() {
	add_image_size( 'thumb-738×400', 738, 400, true );
}
add_action( 'after_setup_theme', 'frontier_new_image_size' );

Use the new image size

function frontier_change_thumbnail_size() {
	return get_the_post_thumbnail( get_the_ID(), 'thumb-738×400' );
}
add_filter( 'frontier_excerpt_thumbnail', 'frontier_change_thumbnail_size' );

Note: Adding a new image size through the function add_image_size will only affect newly uploaded images. You could use a plugin like this ( regenerate thumbnails ) to process old images. You can deactivate/delete when done.