WordCast

Post Images and Thumbnails Supported in WordPress 2.9

Image courtesy WPEngineer

Image courtesy WPEngineer.com

WPEngineer is reporting this morning that WordPress 2.9 adds native support for post thumbnails, a staple of “magazine” and “newspaper” style themes for years.

Up until this point, you needed to use custom fields in WordPress to set an image URL, then specially code PHP to pull from that custom field in a theme file in order to designate a thumbnail, or “post image”.

As seen in the screenshot above, there’s a new box in your Write Post panel that allows you to specify a thumbnail for your post. The following template tag can then be used in your theme’s PHP files (within The Loop) to insert the HTML code needed to automatically add that image in:

<?php the_post_image(); ?>

Multiple sizing parameters can also be used with this tag to customize its’ display, including:

the_post_image('thumbnail'); // Thumbnail size

the_post_image('medium'); // Medium sized

As of right now there’s no way to style the image in your admin interface to display with a certain alignment, etc. That will all have to be done with your theme’s stylesheet and PHP files, but I think we can expect plugins that will add features like this and more not too far off into the future.

Here at WordCast we expect backward compatibility conscious theme developers to begin phasing this into their work by supporting both this new tag and the custom field options, depending on which a user prefers, and which version of WordPress they may be using. (Though, really, as we’ve said a million times, keeping up to date is important!)

Leave a Reply