We know seven cows have a very powerful thumbnail function, although WordPress also has thumbnail function, but in contrast, seven Niuqiang too much, and the resulting thumbnails are sized to fit, and are all in the seven cow cloud storage above, so this version of the biggest improvement is the new wpjam_post_ Thumbnail function, he will directly generate thumbnails directly using the seven cow thumbnail API.
<code><? PHP if (Wpjam_has_post_thumbnail ()) {?>
<div class= "Entry-thumb" >
<a href= "<? PHP the_permalink ()?> "title=" <? PHP The_title_attribute ();?>
" ><? PHP wpjam_post_thumbnail (Array (150,150), $crop =1);? ></a>
</div>
<? PHP}?></code>
This function has two parameters:
- $size: Set the size of the thumbnail, which is an array, such as in the above example, set the thumbnail size: width is 150px, height is 150px.
- $crop: Sets whether the thumbnail is cropped, 1 is cropped, and if 0, it is scaled only by the maximum edge, without cropping.
Another powerful thing about this function compared to the WordPress default The_post_thumbnail function is that if you don't set a thumbnail, it will automatically get the first picture as a thumbnail.