Getting custom size image URL

I added custom image size like below.

add_image_size( 'team-member', 220, 220, true );

I can get this image like below in the post.

Read More
the_post_thumbnail( 'team-member' );

But how can I get image URL if it’s outside of loop. For example, is there any way to get image URL like this and use it inside shortcode?

<img src="http://URL.../member1-220x220.jpg">

UPDATE:

For now, I’m getting it like below. Is there any better solution?

$image_extension = substr( $image, -4 );
$image = str_replace( $image_extension, '-220x220' . $image_extension, $image);

Related posts

Leave a Reply

1 comment