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.

Now when I have excerpts on the home page the image is a small square, but I'd like to change it to a fill the entire width of the content area. (as if the image was in a post.) My theme is responsive so I'm assuming I'll need to use percents instead of pixels.

Any ideas?

Thanks!

share|improve this question
1  
1. (If it's publicly available) what's the theme? 2. What's the code used to display thumbnails like? (add it to your question) –  its_me Jul 7 '12 at 1:58
add comment

1 Answer

You'll need to do a couple of things.

First, in your functions.php file you'll want to find the section that deals with post thumbnails and add an appropriate images size if one is not already included.

To do this, you'll want to use add_image_size()

<?php add_image_size( $name, $width, $height, $crop ); ?>

where name is the reference name of the the image size, width is the width the image will be re-sized to if it is larger than this size, height the height it will be re-sized to (in this case you can use something like 9999 so that is will take the correct aspect ratio to the width), and crop is weather or not a hard crop should be used (probably not for what you want). The $name MUST be wrapped in quotes and $crop is either true or false.

Then in your theme you want to locate the position of the code that outputs your image and find the class or id being assigned to the image or to a container for the image and, using css set a width of 100% on the container and/or the image and a max-width of the desired width at the largest view-port size for which you are styling.

Finally you will want to modify the call the_post_thumbnail()

<?php the_post_thumbnail( $size, $attr ); ?>

if there is a coma, you want to change the string to the left of it to match the name from the add_image_size. if there is no coma, you want to change it all to the name you chose. The name MUST be wrapped in quotes.

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.