Skip to content

Instantly share code, notes, and snippets.

@amirkheirabadi73
Created September 21, 2013 14:20
Show Gist options
  • Save amirkheirabadi73/6651074 to your computer and use it in GitHub Desktop.
Save amirkheirabadi73/6651074 to your computer and use it in GitHub Desktop.
Post Thumbnails
Sample Functions.php:
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 150, 150, true ); // default Post Thumbnail dimensions (cropped)
// additional image sizes
// delete the next line if you do not need additional image sizes
add_image_size( 'category-thumb', 300, 9999 ); //300 pixels wide (and unlimited height)
}
in File :
<?php the_post_thumbnail( $size, $attr ); ?>
Read More:
http://codex.wordpress.org/Function_Reference/the_post_thumbnail
https://codex.wordpress.org/Post_Thumbnails
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment