"<?" yerine "<?php" kullanın. ayrıca "echo ($resim)" şeklinde bir kullanım yok php'de
<h1><?php the_title() ?></h1>
<?php $resim = get_post_meta($post->ID, 'resim', true);
if($resim) : ?>
<a href="<?php the_permalink() ?>" title="<?php the_title() ?><img class="alignleft" src="<?php echo $resim ?>" width="615" height="315" alt="<?php the_title() ?>" /></a>
<?php else : ?>
<a href="<?php the_permalink() ?>" title="<?php the_title() ?><img class="alignleft" src="resim-urlsi-buraya" width="615" height="315" alt="<?php the_title() ?>" /></a>
<?php endif; ?>
umarım işini görür.
İlk dediğinle alakalı olarak pek bilgim yok, her ikisi de çalışıyor.
Fakat kod çalışmadı.