has_post_thumbnail always returns true in 3.6
-
The problem is quite easy. has_post_thumbnail always returns true.
<article class="box-<?php echo $counter--; ?>"> <h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <?php if ( has_post_thumbnail() ) : ?> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail(); ?></a> <?php else : ?> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">TESTING</a> <?php endif; ?> </article>
This will always return the first snippet and never the else-function, even when there is no featured image there. (Yes, this is put in the loop.)
– No plugins
– Making a child theme of “2013”
- The topic ‘has_post_thumbnail always returns true in 3.6’ is closed to new replies.