how to check if particular post thumbnail exist, display that one
-
I have a few defined post thumbnail sizes, and I want a check performed to say, “if SQUARE size, show that, then if not, show default Post Thumbnail”.. but this below doesnt seem to work:
<?php if(has_post_thumbnail('square')) { ?> <?php the_post_thumbnail('square'); ?> <?php } elseif(has_post_thumbnail()) { ?> <?php the_post_thumbnail(); ?> <?php } >
Even though the SQUARE size exists, it just shows the normal size defined by the post thumbnail default setting. How do I get it to display the square image first, if it exists?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘how to check if particular post thumbnail exist, display that one’ is closed to new replies.