Display the post only if thumbnail is set up
-
I think I have successfully been able to display the last 3 thumbnails of a set of subpages in chronological order.
Now I’d like to add a conditional statement that will only display the post if the page has a thumbnail set up. I’m a novice with PHP. I’d appreciate the help.
This is the current code.
<?php query_posts( array( 'post_parent' => 12, 'post_type' => 'page', 'posts_per_page' => 3,) ); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="work-item"><?php the_post_thumbnail(); the_title(); ?> <a href="<?php the_permalink() ?>">View Details</a> </div> <?php endwhile; endif; ?>
- The topic ‘Display the post only if thumbnail is set up’ is closed to new replies.