[Howto] Add post-thumbnails to wordpress child themes.
I needed a way of adding post-thumbnails ( featured image in 3.0 ) to my latest theme.
The theme JustCSS is a child theme of Toolbox.
I wanted a way of adding this code to functions.php without editing the Toolbox core files, so updates are still workable.
First thing was to enable featured images by adding the support line to functions.php in my child theme folder.
Now I can go ahead an assign an image to my test post but the image will never show so I needed to add a filter to the_content to add the thumbnail.
Here is the finished code in my functions.php:
[php]
add_theme_support( ‘post-thumbnails’ );
add_filter( ‘the_content’, ‘add_thumbs’ );
function add_thumbs( $content ) {
the_post_thumbnail( ‘thumbnail’ );
return $content;
}
[/php]
The theme will be available on this site soon, and on WordPress.org as soon as child themes are allowed.