Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript The Loop. How can I grab most recent post from CATEGORY? Re: The Loop. How can I grab most recent post from CATEGORY?

#73838
TheDoc
Member

It’s no problem! Just open up your functions.php and add the thumbnail support. I’m going to post one that I just used in a project:

// post thumbnail support
if ( function_exists( 'add_image_size' ) ) add_theme_support( 'post-thumbnails' );

if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'featured-stylist', 220, 220, true );
add_image_size( 'photo-gallery', 130, 130, true );
add_image_size( 'stylist-detail', 253, 323, true );
add_image_size( 'stylist-listing', 150, 150, true );
}

You’ll notice that I set up a bunch of different sizes. This is because I don’t want the images to be the same size on different templates.

In each template I am able to call a specific size by going like this:

If you add new sizes after an image has already been uploaded, you’ll have to re-upload your images. But wait! There’s a lovely plugin that goes through all of your images and recreates all of the thumbnails for you – phew!

After you’ve added the thumbnail functionality, you should see a “Set Featured Image” link on the right of your visual editor when editing a post or page in the WordPress backend.