Conditional statement check if post has thumbnail
-
Hi,
I am stuck with some conditional statement that checks wether a post has a thumbnail. If the post has a thumbnail it should print the thumbnail, if not it should print the excerpt.
I am aware of the function has_post_thumbnail but since I am using the DP Thumbnail plugin this function is not working as it should.I have been messing around with code but can not get it to work. Any help is greatly appreciated.
This is my code<?php $IDOutsideLoop = $post->ID; $args = array( 'numberposts' => 100, 'orderby'=> 'post_date'); $postslist = get_posts( $args ); foreach ($postslist as $post) : setup_postdata($post); ?> <div class="post"> <div class="image" <?php if(is_single() && $IDOutsideLoop == $post->ID) print 'style="visibility:hidden";' ?>><?php dp_post_thumbnail(); ?></div> <div class="hover"> <div class="titel"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div> </div> </div> <?php endforeach; ?>
Basically I would want something simple as:
if (dp_post_thumbnail());{ <div class="image" <?php if(is_single() && $IDOutsideLoop == $post->ID) print 'style="visibility:hidden";' ?>><?php dp_post_thumbnail(); ?></div> }else { <?php the_excerpt();?> }
But this doesn’t seem to work. Any ideas?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Conditional statement check if post has thumbnail’ is closed to new replies.