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.

am Having Custom Field named as thumb.i want to show the images using these custom fields.i want to be fix the image size.

My code is

 <img class="thumb" src="<?php echo get_post_meta($post->ID, 'thumb', true) ?>" alt="<?php the_title(); ?>" />

i tried timthumb also like this

 <img class="thumb" timthumb.php?src="<?php echo get_post_meta($post->ID, 'thumb', true) ?>"&q=100 alt="<?php the_title(); ?>" />

any one help me. thanks in advance.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

You'd be better off using the inbuilt Post Thumbnails, which were introduced in WordPress 2.9 - these are easier to use than custom fields and have things like sizing built in.

Once you've enabled Post Thumbnails, you can set their default size using set_post_thumbnail_size and then use them in your theme with the_post_thumbnail

share|improve this answer
    
you are right @:tallphil,am familiar in that.Here i want to take the images from outside of my website.so only i used custom field.here post thumbnails is not working.i gave the direct link of the images in my custom field.thanks for your try... –  Ramkumar Sep 13 '11 at 10:53
    
ok, in that case timthumb is probably your best bet. You had some errors in the HTML markup posted above, I've described them in a separate answer below... –  tallphil Sep 13 '11 at 11:18

You have an error in the second (timthumb) code. The src= was after the tumthumb.php instead of before, plus the " should be after the &q=100. It should be:

<img class="thumb" src="timthumb.php?<?php echo get_post_meta($post->ID, 'thumb', true); ?>&q=100" alt="<?php the_title(); ?>" />
share|improve this answer

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.