temanızın functions.php dosyasına aşağıdaki kodu ekleyin

function get_thumbnail($postid=0, $size='full') {
if ($postid<1)
$postid = get_the_ID();
$thumb = get_post_meta($postid, "resim", TRUE);
if ($thumb != null or $thumb != '') {
echo $thumb;
}
elseif ($images = get_children(array(
'post_parent' => $postid,
'post_type' => 'attachment',
'numberposts' => '1',
'post_mime_type' => 'image', )))
foreach($images as $image) {
$thumbnail=wp_get_attachment_image_src($image->ID, $size);
?>
<?php echo $thumbnail[0]; ?>
<?php
}
else {
echo get_bloginfo ( 'stylesheet_directory' );
echo '/images/resim-yok.jpg';
}
}

temada kullanımı


<?php echo get_thumbnail($post->ID);?>
özel alan resmini gösterir / özel alan resmi yoksa yazıdaki kayıtlı ilk resmi gösterir/ hiç resim yoksa tamadaki /images/resim-yok.jpg sabit resimi gösterir

sabit resimi 1x1 boş transpparan gif yaparsanız hiç bir şeyde görtermeye bilir



$thumb = get_post_meta($postid, "resim", TRUE); "resim" bölümünü kullandığınız özel alan ismi ile değiştirin