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'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.

share|improve this question
    
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
add comment

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
Yep add_image_size was what I needed. Thanks. –  tks Jul 27 '11 at 6:29
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.