I’m trying to use the Post Image plugin (v. 1.1.1, i.e. most recent version) on a recent project, but I’m running into problems with posts that don’t have an associated image. This happens despite the fact that I’m using the conditional given as an example on the plugin page:
<?php $thumb = szub_post_image('use_thumb=1&display=0'); ?> <?php if($thumb) : ?> <a href="<?php the_permalink(); ?>"><?php echo $thumb; ?></a> <?php endif; : ?>
I use this within the loop, nothing special. I expect this code to check whether there is any thumb, and to return nothing if there is nothing. It turns out, however, that $thumb is somehow set (or at least not empty) even if there is no image associated with the post. On a page listing 10 posts of which two have an associated image, the result is that empty
<img>tags are scattered all over the place.
Hence my question: does Post Image actually expect every post to have an image? If it does, could anyone give me a lead on how to solve my particular problem, on what to do when a post doesn’t have one? If it doesn’t, what am I doing wrong?
- The topic ‘Post Image – does it expect every post to have an image?’ is closed to new replies.