I buy many ‘Premium WordPress‘ themes from designers and lots of them are very good, however I do get a little frustrated when designers go heavy on the custom fields to provide things like different size images for different pages, when if they read a little further into the WordPress documentation they would see that there are many great inbuilt features that they could use to do the same job.

My pet peeve is having to copy and paste image urls into custom field boxes. Theme designers, I want to introduce you to the world of Featured Images. Get to know it, learn it’s associated functions and it will make life easier for you and for your clients. TRUST ME

  1. Add support for post thumbnails
  2. Add additional image sizes
  3. Utilize the gallery functionality

At the very least you should add support for post thumbnails to your theme. This feature has been in WordPress for quite some time so there is no excuse not to include it if you are designing a new theme

Add Post Thumbnails

Add this little snippet of code to your theme functions.php . Doing this will mean you can then take advantage of the ‘Featured images’ functionality within the add/edit post admin screen.

<?php add_theme_support('post-thumbnails'); ?>

Add Additional Image Sizes

Using this really neat bit of code, you can remove the need for having a custom field for every size of image used on your theme page.

Once more in your functions.php add the following code

if (function_exists('add_image_size')) {   
 add_image_size('imgsizename', width, height, TRUE);     // last param is tells wordpress whether to crop or not

you can add as many image sizes as you need and so can create different sizes that match image regions in your theme. Using this code means that when you upload an image to the media library, it will create the additional images sizes for you. Once that is done, you call the size image you want in the region in which it is to be shown by using

print the_post_thumbnail('imgsizename', 
                                    array('id' => "imagename", 'alt' => 'myBigImage', 'class'=>'myBigImageClass')

Hopefully you’ll find that using this core functionality will omit the need for so many custom fields, save you time and save your clients some frustration.