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.
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);
You can do this with a piece of the code from the “Post Thumbnail Linking to large Image Size” example on the get_the_post_thumbnail page (using wp_get_attachment_image_src):