How to Create a New Featured Image Size in Genesis

By on Dec 14, 2010 in Genesis |

Share On GoogleShare On FacebookShare On Twitter

When WordPress 2.9 was released, along with it came support for featured images. Originally termed post thumbnails, this capability made it very easy for folks who developed news and magazine style site to include smaller images on a homepage.

The Genesis theme framework was built to include this feature and there are many instances it can be used – whether it be on a category archive page, an author archive page or a homepage.

Many people know that WordPress provides you a way of defining sized of images that you can place into a post. If you go to Settings > Media page in your dashboard, you will see something like this:

media settings

The problem that many of us run into is that we want to display featured images of various sizes (in additional to the default 150px by 150px thumbnail size) throughout our site. Thankfully, the Genesis theme framework has a built-in feature that allows you to define additional featured images sizes.

To create a new featured image size, all you need to do is open up your child theme’s functions.php file, and place this code anywhere after the opening <?php and before the closing ?> tags:

// Add new image sizes
add_image_size('Homepage Thumbnail', 120, 80, TRUE);

So your child theme’s functions.php file might start out looking like this:

// Start the engine

// Add new image sizes
add_image_size('Homepage Thumbnail', 120, 80, TRUE);

The code above will generate featured images that are 120px wide by 80px high and label it Homepage Thumbnail. There are a few places that you’ll now be able to use the new featured image size. The first, and most obvious, is for magazine style homepages that have a featured section.

An example of that would be the Lifestyle child theme homepage, and would look like this:

lifestyle featured images

The other location would include any blog, archive, author, blog, category, search, and tag pages. To define the featured image size used here, you can select that in the “Content Archives” section on the Genesis > Theme Settings page in your WordPress dashboard.

An example of that would be the AgentPress child theme category archive page, and would look like this:

agentpress featured image

Keep in mind that anytime you define an additional featured image size while using the code above, it will show as an option in the dropdown menus when using the Genesis Featured Post widget or the “Content Archives” option on the Theme Settings page.