Featured image as header image or post image
add below in function file
addthemesupport( 'post-thumbnails' );
setpostthumbnail_size( 624, 9999 ); // will set image width 624px and Unlimited height, soft crop
</code></pre>
add below in your template file
<?php
if ( haspostthumbnail() ) {
// the current post has a thumbnail
thepostthumbnail();
} else {?>
<img src="<?php echo gettemplatedirectory_uri(); ?>/images/place-hoder-img.jpg" class="">
<?php
}
?>
</code></pre>
Written by Rajesh Khatri
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Wordpress
Authors
Related Tags
#wordpress
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#