WordPress custom thumbnail size

I’am trying to make custom thumbnail sizes in WordPress. Currently I have following code in functions.php

<?php

add_image_size( 'featuredImageCropped', 310, 150, false );

function custom_excerpt_length( $length ) {
    return 15;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

And I’am trying to access this thumbnail in index.php with following code:

<img class="keis-image" src="<?php $kuva = get_field('kuva');$image = wp_get_attachment_image_src( $kuva['id'], "featuredImageCropped"); echo $image[0]  ?>"/>

However it will return full image instead of resized thumbnail, if I change featuredImageCropped to large or some other basic thumbnail size it will return it as it should.

How could I get my custom thumbnail to render as I’d like to?

Leave a Comment