Just wondering why you are using $values = get_post_custom_values(“issue-cover”); so many times. You are missing the post->ID argument as the second parameter. You only need to define this variable once and then use it over and over.
I’m also wondering why you don’t use post-thumbnails to solve this. There are two handy functions that are baked into WordPress such as the following:
- has_post_thumbnail()
- the_post_thumbnail()
Your code would look like this:
<?php
global $post;
$values = get_post_custom_values("issue-cover", $post->ID);
$title = get_post_meta($post->ID, 'issue', true);
$designer = get_post_meta($post->ID, 'cover-by', true);
if(has_post_thumbnail()):
echo "<a target="_blank href="https://wordpress.stackexchange.com/questions/28057/{$values[0]}">";
the_post_thumbnail(array(HEIGHT,WIDTH), array('title'=>$title));
echo "</a>";
else:
echo "<img src="".get_bloginfo("stylesheet_directory')."/images/no-img.gif' title="$title" alt="$title" />";
endif;?>
To address the post meta not displaying, you will need to make sure you are operating within the loop.