0
  1. In Loop = There exist a way or hook to get the featured image, if not, the the first image from post and cropit before display it on frontend?

  2. Re-asking my question: On upload. How do I set a featured crop size for a giving custom post type like: news.

Thanks in advance.

  • Re-asking my question: How do I set a featured crop size for a giving custom post type like: news. – José Pablo Orozco Marín Feb 9 '11 at 1:49
  • are you using featured images on any other post type or just the one? – curtismchale Feb 9 '11 at 2:55
2

In your theme's functions.php add a call add_image_size($name, $width, $height, $crop) where $name is the name or identifier for the new size, and $crop is whether the image should cropped to fit the dimensions or just shrunk to fit within the dimensions given. This will register the new size that will be automatically created when you upload new images:

add_image_size('news-thumbnail', 500, 200, true);

Then in the template file for your news post type, call the specific thumbnail size name:

the_post_thumbnail('news-thumbnail');
|improve this answer|||||

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.