• i use this code to echo thumbnail for first post in loop.

    [ Moderator Note: Code backticks fixed. ]

    <?php $count = 0; $loop_baihoccuocsong1 = new WP_Query('cat=3&showposts=1'); // Them category 2
    while($loop_baihoccuocsong1->have_posts()) : $loop_baihoccuocsong1->the_post(); ?>
    
        <a>" rel="bookmark" title="<?php the_title_attribute(); ?>">
            <?php
                if($counter==0)
                    {
                    echo '<img src="<?php echo get_post_meta($post->ID, "thumbnail", true);?>;$counter++;"/>' ;
                    }
            ?>
        </a>
    
        <div class="h_bai-hoc-cuoc-song-1">
            <a>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
            <?php the_content(); ?>
        </div>
    
    <?php endwhile; ?>
    <?php wp_reset_postdata(); // Reset the query ?>

    There are any error in if clause.
    Browser cannot echo url thumbnail.
    Please help me fix it.
    Thank you !

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘how to put in if clause ?’ is closed to new replies.