Please help me. thanks

<?php
if ( wt_get_option( 'wt_show_post_img' ) == 1 ){
if (has_post_thumbnail() ) { ?>
<div class="thumbnail single-post-thumbnail"><?php the_post_thumbnail( 'wt840_420' ); ?></div><?php
}

} ?>

Where do you get wt_get_option() ? is that part of the theme's functions? If you are trying to get options you are need to use: get_option('option_name');

Also you need to make sure you are doing your conditional statment in the wordpress loop.

<?php if( have_posts() ): while( have_posts() ): the_post(); ?>
    <?php if( has_post_thumbnail() ): ?>
        <div class="thumbnail">
            <?php the_post_thumbnail(); ?>
        </div>
    <?php endif; ?>
    <h2><?php the_title(); ?></h2>
    <?php the_content(); ?>
<?php endwhile; endif; ?>

Its in the codex: Click Here

Hey man thanks for the reply. I was modifying a commercial theme, I just need the code for the else to remove the div if there is no thumbnail,

Im having trouble because on the code there is <?php on the end of the div statement.

    <?php
    if ( wt_get_option( 'wt_show_post_img' ) == 1 ){
    if (has_post_thumbnail() ) { ?>  <---- this is closing php so you can add html
    <div class="thumbnail single-post-thumbnail"><?php the_post_thumbnail( 'wt840_420' ); ?></div><?php <---- This is opening up the php so you can work with php.
    }
    } ?>

Not sure what you are looking for? the example I gave is a good solution.

you could try this:

if( has_post_thumbnail() ){
?>

<div class="thumbnail"><?php the_post_thumbnail(); ?></div>

<?php

}else{
//Show whatever you want instead.. like maybe the title

<h2 class="page-title"><?php the_title(); ?></h2>

}

It gives me a blank page.

Try putting this in you index.php file located in the root..

error_reporting(E_ALL);
ini_set('display_errors', 1);

or set debugging to TRUE in your wp-config.php file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.