WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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

Hi can anyone tell me a good way to use a custom image size with a custom field image in a template without using something like timthumb/phpthumb.

I've set an image size with...

add_action( 'after_setup_theme', 'theme_setup' );
function theme_setup() {
add_image_size( 'theme-custom-size', 329, 118, true );

which is fine for the featured image, I just call

the_post_thumbnail( 'theme-custom-size' );

but could I apply this size to an image grabbed with get_post_meta from a custom field image.



ok, I think a simple way to do it would be to use this plugin http://wordpress.org/extend/plugins/multiple-post-thumbnails/ and use multiple featured images rather than custom fields.

share|improve this question

migrated from stackoverflow.com Jul 1 '11 at 14:22

This question came from our site for professional and enthusiast programmers.

Yes, I was just about to suggest Multiple Post Thumbnails. It should do what you want with the minimum of effort. – Matt Gibson Jul 1 '11 at 13:17

when you get image form post_meta, you get the path to the image, then you get do something like :

<img src="<?php echo get_post_meta(ID,'customr field name',true); ?>" 
        width=200 height=200 />
share|improve this answer
thanks, but I'd rather do the resize server side to prevent a lot of large images from being downloaded, also this method does not crop the images. – tom Jul 1 '11 at 10:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.