Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have somee Item in the media library, where I want to retrieve the thunbnail from. I use the normal post thumbnail functions (tried some of them), with normal posts or cpts's the work fine.

As media library items are handled, similiar to posts, I thought the normal wp thumb function could work there, too. There are also thumbs created, as i can see on the server.

But no one fo WP's Thumb Fuunctions returns that thumb.

Here an example Function, I use:

 <?php echo get_the_post_thumbnail($post->ID, 'size-1'); ?>

The post ID is correct. The Thumbnail size is registered and works for other posts fine.

Thank YOu!

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

wp_get_attachment_image($post->ID, 'size-1');

The "post thumbnail" actually gets the featured image that is attached to the post. For an attachment, you want the attachment itself in a specific size, which isn't the same as the featured image.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.