I am creating a WordPress theme and am trying to create different images of different sizes for the images that the user uploads to the "Advanced custom fields" field. However, when I use the code below, use the Regenerate Thumbnails plugin to create new image sizes that do not seem to be affected.
I feel that there is something very simple that I am missing, because of everything I read, this should work. The code below is a shortened version of the actual function, there are several smaller image sizes in the one I use.
function test_add_image_sizes() {
add_theme_support( 'post-thumbnails' );
add_image_size( "main-image", 700, 680, true );
add_image_size( "main-image-350", 350, 450, true );
add_image_size( "main-image-539", 539, 573, true );
add_image_size( "main-image-659", 659, 570, true );
add_image_size( "main-image-850", 850, 650, true );
add_image_size( "main-image-1000", 1000, 650, true );
add_image_size( "main-image-1200", 1200, 680, true );
add_image_size( "main-image-1400", 1400, 680, true );
}
add_action( 'init', 'test_add_image_sizes' );
The above code fits into my themes functions.php.
source
share