Before the release of WordPress 2.9, setting up “post-image” support for your blog was a more tedious task than it needed to be. Fortunately, this is no longer an issue. I'll show you how to set it up in this four-minute video quick tip.
// Enable support for post-thumbnails add_theme_support('post-thumbnails'); // If we want to ensure that we only call this function if // the user is working with WP 2.9 or higher, // let's instead make sure that the function exists first if ( function_exists('add_theme_support') ) { add_theme_support('post-thumbnails'); }
In the "if have_posts()" loop, just place this code wherever you like. At this point, WordPress will insert the image tag on the page accordingly. Note that you will have access to the "wp-post-image" class, which you can then use to format/style the image.
The above is the detailed content of Pro Tip: Master the new 'Post Thumbnail” feature in WordPress 2.9. For more information, please follow other related articles on the PHP Chinese website!