Wordpress 2.9 has a new post thumbnail feature that I’ve been exploring as part of this site’s layout in preparation for updates to some client sites. Adding the code below to your child theme’s functions.php file will activate the post thumbnail feature in WP2.9, then change the default content display on the home page or front page to post excerpts (rather than full post content) and finally add the thumbnail itself to the excerpt text.
// Add post thumbnail support in WP2.9
if ( function_exists( 'add_theme_support' ) )
add_theme_support( 'post-thumbnails' );
// Change default content display on home page to excerpt
function childtheme_content($content) {
if (is_home() || is_front_page()) {
$content= 'excerpt';}
return $content;
}
add_filter('thematic_content', 'childtheme_content');
// Add post thumbnail to post excerpt
function add_post_thumb($title) {
return get_the_post_thumbnail(NULL, 'thumbnail') . $title;
}
add_filter('get_the_excerpt', 'add_post_thumb');
I prefer the thumbnail underneath the post title and author meta information. However, if you wanted the thumbnail to appear next to the title, replace get_the_excerpt in the last line with thematic_postheader_posttitle. Use CSS to get the positioning that you prefer. Note that the thumbnail will appear wherever excerpts are shown – use the same conditional code as shown with childtheme_content() to limit it to the home/front page if you prefer.
Add the_post_thumbnail to post excerpts
Wordpress 2.9 has a new post thumbnail feature that I’ve been exploring as part of this site’s layout in preparation for updates to some client sites. Adding the code below to your child theme’s
functions.phpfile will activate the post thumbnail feature in WP2.9, then change the default content display on the home page or front page to post excerpts (rather than full post content) and finally add the thumbnail itself to the excerpt text.// Add post thumbnail support in WP2.9 if ( function_exists( 'add_theme_support' ) ) add_theme_support( 'post-thumbnails' ); // Change default content display on home page to excerpt function childtheme_content($content) { if (is_home() || is_front_page()) { $content= 'excerpt';} return $content; } add_filter('thematic_content', 'childtheme_content'); // Add post thumbnail to post excerpt function add_post_thumb($title) { return get_the_post_thumbnail(NULL, 'thumbnail') . $title; } add_filter('get_the_excerpt', 'add_post_thumb');I prefer the thumbnail underneath the post title and author meta information. However, if you wanted the thumbnail to appear next to the title, replace
get_the_excerptin the last line withthematic_postheader_posttitle. Use CSS to get the positioning that you prefer. Note that the thumbnail will appear wherever excerpts are shown – use the same conditional code as shown withchildtheme_content()to limit it to the home/front page if you prefer.