WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for a way to only set the width of a thumbnail size and let the height set auto. So if I have two images. One is 600px/420px and one is 600px/600px. I want to set only the width of the thumbnail to 200px so wordpress crops the thumbnails of the above dimensions to 200px/140px and 200px/200px. Any ideas?

share|improve this question
up vote 6 down vote accepted

In your theme's functions.php file:

/* register new image size
 * 200px wide and unlimited height
 */
add_image_size( 'wpse73058', 200, 9999, false );

In a template or the like:

if ( has_post_thumbnail() ) { the_post_thumbnail( 'wpse73058' ); }
share|improve this answer

protected by Pieter Goosen Mar 20 '15 at 11:39

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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