Home / WordPress register and get custom size thumbnail

WordPress register and get custom size thumbnail

For registration add this code on function.php

add_image_size( 'size-name', 220, 180, true );

size-name It’s must should be unique but you can use any name for this.
220 = Width (You can add your custom width here).
180 = Height (You can add your custom height here).

For get that image from anywhere.

$GetThumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'size-name' );
$Thumbnail    = $GetThumbnail[0];

You must need to enter the name size-name as same as you was register.

If you want to learn more about this follow this article

all rights reserved