I am in the process of developing a new theme for my blog and am making a featured content slider. The issue that I am having is getting wordpress to force the image to the dimensions that I want it to be. The exact dimensions are 494px x 168px. I've tried simple using the_post_thumbnail( array(494, 168) );, but that didn't work. I also tried adding a custom image size to my functions file. This would sometimes get the height right (but not always), but didn't get the width right a single time. Could somebody please give me a way to force the dang image to be 494px X 168px?
Tell me more
×
WordPress Answers is a question and answer site for
WordPress developers and administrators. It's 100% free, no registration required.
|
|
|||
|
|
|
For post thumbnails you can either crop and image to the thumbnail size or scale the image. To enable crop you can call the thumbnail 1 of 2 ways.
and then call it in the theme file
The true tells wordpress to crop the image rather than scale, to scale leave true out.
Also, the_post_thumbnail doesn't work on images already uploaded. To test if the sizes truly aren't working upload a new file after adding the new thumbnail size/calling it in your theme file. Mark on Wordpress has a good tutorial on Post Thumbnails http://markjaquith.wordpress.com/2009/12/23/new-in-wordpress-2-9-post-thumbnail-images/ |
|||||
|
