treehouse : what would you like to learn today?
Web Design Web Development iOS Development

[Solved] Wordpress thumbnails

  • Hey guys!

    I'm actually having some kind of a small problem I guess. Basically I want to have the possibility to have different thumbnail sizes. Im having 3 types of posts, the blog post, which has a small 274x9999 size. The Work post, which has a bigger 635x9999 size and the background post, which is a post type where I can upload backgrounds which people can download, but for previewing those backgrounds I want of course a thumbnail which will be 249x147 big.

    As I was reading the wp-codex I come across a function called add_image_size() - so from the documentary I've been reading, I can, with theme support (post-thumbnails), create a bunch of image sizes, so what I did was the following:

    add_theme_support('post-thumbnails');

    add_image_size( 'background-thumb', 249, 147 );
    add_image_size( 'blog-thumb', 274, 9999 );
    add_image_size( 'work-thumb', 635, 9999 );


    I added this code to my functions.php, added all sort of featured post images and added into my index.php the following (of course into the loop):

    <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'background-thumb' ); } ?>


    Well, it displays the usual 150x150 thumbnail of wordpress. Anyone know how I can make this work?

    Regards.
  • Nevermind, got it working by setting the fourth parameter of the add_image_size to true. By default it seems to be false.