1

I'm working on a custom theme that I've inherited to maintain. At the top of the homepage there is a header area with some images generated by get_the_post_thumbnail. The call to get_the_post_thumbnail outputs img objects that are set to a specific width/height by their html attributes. Here's the code and output:

Inside a loop

<?php echo get_the_post_thumbnail( $id, array( 300, 300 ) ); ?>

Html output

<img width="215" height="93" src="[img filepath]" class="attachment-300x300 wp-post-image" alt="[img name]" title="[img name]">

I need to reset the attribute height and width dimensions to something other than 215 x 93. I can't find anywhere this is being set (checked in wp-admin as well as functions.php as well as anywhere else where I thought it might be). I am also not finding any places where set_post_thumbnail_size is being called with these values. Can anyone tell me where to reset these values?

Thanks.

  • Is the image larger than 215x93? WordPress will not embiggen a smaller image, to prevent the image from looking like crap. – Otto Jul 26 '11 at 0:33
4

You can look at adding an image size to your themes functions.php file.

http://codex.wordpress.org/Function_Reference/add_image_size

You then just need to do <?php the_post_thumbnail('image-size-name'); ?> and it will pull out the image based on the sizes you set.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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