Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dbridgman/9ac2c040637c6df9f1a3 to your computer and use it in GitHub Desktop.
Save dbridgman/9ac2c040637c6df9f1a3 to your computer and use it in GitHub Desktop.
<div class="post-thumbnail">
//Adjusted the code so it integrates Wordpresses default thumbnail size - This can be changed in Settings -> Media
<?php if ( has_post_thumbnail() ) { the_post_thumbnail('thumbnail'); } else
{ ?>
<img src="<?php bloginfo('template_directory'); ?>/MYIMAGESFILE/MYFEATUREIMAGE.jpg" alt="Post Thumbnail" />
<?php } ?>
</div>
This code pulls a posts thumbnail, then sets a default if the post is lacking one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment