• I’m trying to display a page thumbnail if the custom field is active

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php if (get_post_meta($post->ID, "page_image") == true) { ?>
    <?php the_post_thumbnail( 'page_image_thumb' ); ?>
    <?php }?>
    more stuff below

    I don’t get any page errors but the post thumbnail doesn’t display ?? I’m hoping someone with more php knowledge can tell me if my code is right

Viewing 1 replies (of 1 total)
  • Thread Starter nemci7v

    (@nemci7v)

    Ok I did it! ?? Not sure if that’s the best way to do it but it works.

    <?php
    $key = 'page_image';
    $themeta = get_post_meta($post->ID, $key, TRUE);
    if($themeta != '') { ?>
    <?php the_post_thumbnail( 'page_image_thumb' ); ?>
    <?php }?>
Viewing 1 replies (of 1 total)
  • The topic ‘am I doing this right?’ is closed to new replies.