Please help me. thanks

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

} ?>
2 Years
Discussion Span
Last Post by gabrielcastillo

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(); ?>
    <?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.

    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>


//Show whatever you want instead.. like maybe the title

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


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

ini_set('display_errors', 1);

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.