Edmonton Web Design and Photography

New in WordPress 2.9: Post Thumbnails!


Posted in: Web, Wordpress on January 2nd, 2010

With the latest update to WordPress 2.9 you now have access to a few new functions to handle thumbnails for blog posts.

I will keep this quick as it is a simple process.

You will need to let wordpress know that your theme supports thumbnails. For this we need to open functions.php and declare thumbnail support. For this we add the following line of code.

add_theme_support( 'post-thumbnails' );

We will need to set the thumbnail dimensions now.

set_post_thumbnail_size( 80, 80);

It should be noted that this method of resizing will produce an image no larger than 80×80 and will not distort the image.

If you choose to crop for square thumbnails then you would enable Hard-Cropping. This way your image is exactly the size you want. This method will crop the image center out.

To enable Hard-Cropping you would use the following line of code.

set_post_thumbnail_size( 80, 80, TRUE);

My functions.php now looks like this.

if ( function_exists( 'add_theme_support' ) ) {
	    add_theme_support( 'post-thumbnails' );
	    set_post_thumbnail_size( 80, 80, true );
	}

Read on..

Search


Archive


Subscribe