You can achieve that in many ways ,
but providing that you use a relatively new wordpress, you should use
the_post_thumbnail().
you define it in functions.php , like so :
add_theme_support( 'post-thumbnails' ); //thumnails set_post_thumbnail_size( 150,230, true ); // defaultpost thumbnails
add_image_size( 'your-custom-name-2', 400, 9999 ); // some size thumbnail
add_image_size( 'your-custom-name-2', 400, 300,false ); // another size
add_image_size( 'whatEverName', 100, 100, false ); // yet another
The “false” or “true” parameters regard the cropping mode (read more below )
http://codex.wordpress.org/Function_Reference/the_post_thumbnail
and also here
Display thumbnail from custom field
you should then define a post default image when you upload an image (you will see it on the upload screen ) – then you can just call it in your theme like so :
the_post_thumbnail('whatEverName');
//depending on the size you want.
this however , will get you ONE defined image .
It will also get you the IMAGE ITSELF .
if you want the URL, size or something else, you should use
get_the_post_thumbnail($page->ID, 'whatEverName');
If you want multiple images – you can use this :
<?php //GET THE FIRST IMAGE
$args = array(
'order' => 'ASC',
'orderby' => 'menu_order',
'post_type' => 'attachment',
'post_parent' => $post->ID,
'post_mime_type' => 'image',
'post_status' => null,
'numberposts' => 1, //change if you want another number
);
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $attachment) {
echo wp_get_attachment_link($attachment->ID, 'thumbnail', false, false);
}
} ?>
// CONTENT AND OTHER STUFF...
<?php //GET ALL EXPECT FIRST IMAGE
$args = array(
'order' => 'ASC',
'orderby' => 'menu_order',
'post_type' => 'attachment',
'post_parent' => $post->ID,
'post_mime_type' => 'image',
'post_status' => null,
'numberposts' => -1,
);
$attachments = get_posts($args);
if ($attachments) {
$no_show=true;
foreach ($attachments as $attachment) {
if($no_show) {$no_show=false; continue; }
echo wp_get_attachment_link($attachment->ID, 'thumbnail', false, false);
}
} ?>