$temp = $wp_query; 
  $wp_query = null; 
  $wp_query = new WP_Query(); 
$count = 0; 
 while ($wp_query->have_posts()) : $wp_query->the_post(); 
<div id="post-<?php the_ID(); ?>" class="boxx artistboxx one-third column <?
 php if ($count == 0) { echo 'alpha'; } ?> <?php if ($count == 2) { echo 
'omega'; } ?>">
<a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">
<img src="<?php $key="image"; echo get_post_meta($post->ID, $key, true); ?>" 
class="video-image" />
<span><?php the_title(); ?></span></a>
<?php if ($count == 2) { echo '<div class="clearfix"></div>'; $count = 0; } 
$count++; ?>    
<?php endwhile;?>
$wp_query = null; 
$wp_query = $temp;  // Reset

1 Answer 1


Are you trying to show the 'featured image'? Or can you use it? If so, there is a simple way to do it:

Add this line of code in your theme’s functions.php file, or be sure that it has this:

add_theme_support( 'post-thumbnails' );

Add this line where you want to show the image:


Following what you seem to be doing, that is, using a meta field, try to put in a variable before echoing, sometimes it helps me spoting another problems in the code. Ex:

$key_1_value = get_post_meta($post->ID, $key, true);
echo $key_1_value;
  • Oh my god, you just solved the problem, and the thing that was wrong was very stupid - I was not using meta on this website at all, I copied the code from one of my other sites, not realising that it wasn't utilising the regular thumbnails. Thank you so much! :)
    – Iva
    Commented Sep 22, 2017 at 15:02
  • Glad I could help =) Commented Sep 22, 2017 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.