Add Custom Image Size WordPress

May 24th, 2012 by
To add custom image size to be auto-cropped in wordpress put this code in the funtions.php file of your theme.
if ( function_exists( 'add_image_size' ) ) { 
	add_image_size( 'category-thumb', 220, 180, true ); //(cropped)
}
Then to output the desired custom size put this code wherever you will want the image to show..
<?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'category-thumb' ); } ?>

Post a Comment

You must be logged in to post a comment.

Cached at: 2024-12-22 06:17:23am