Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

The default thumbnail size for the Wordpress theme I use generates category thumbnails for the homepage and archive page at 200x110px. I would like to add a custom thumbnail size for a specific category of 200x200px that would display on the homepage and on the category archive page. I have experience working with Wordpress but I am not an expert. Based on the responses I've read to similar questions, I believe the answer lies in functions.php but I need detailed instructions on how to achieve this. If anyone could help, I would greatly appreciate it.

Thanks!

share|improve this question
    
possible duplicate of Set featured image size for a custom post type –  Brian Fegter Sep 24 '12 at 15:29
    
How does the Theme generate the thumbnails for your Categories? That's nothing built into WP by default. Please show the relevant code lines. –  kaiser Sep 25 '12 at 0:44

1 Answer 1

Put this code on your functions.php

add_action( 'after_setup_theme', 'clonecell_theme_setup' );
function clonecell_theme_setup() {
    /* Set Default Image Sizes*/
    add_image_size( 'mini-thumbnail', 50, 50, true ); // for clonecell recent post widget
}

Or if you already have an action hook on after_theme_setup,put the add_image_size on that function.

Add another add_image_size using this format

add_image_size($name, $width = 0, $height = 0, $crop = false)

Hope this help.

share|improve this answer
    
You don't need to use a callback for add_image_size(). You can call it directly within your functions file. –  Brian Fegter Sep 3 '12 at 2:18
    
My theme does seem to have an action hook on after_theme_setup: add_action( 'after_setup_theme', 'ar2_setup', 10 ); –  Bodhitree Sep 3 '12 at 13:54
    
This code is in my theme's functions.php:add_action( 'after_setup_theme', 'ar2_setup', 10 ); if ( !function_exists('ar2_setup') ) : –  Bodhitree Sep 3 '12 at 14:11
    
My theme does have an action hook on after_theme_setup. So, do I insert the code you provided for add_image_size immediately below that, with the height and width set to 200? I just don't want to do anything that will cause an error. Also, how is this thumbnail size called for a specific category for both the homepage and archive pages? I don't see anything in the code that would associate the custom thumbnail size with a category. @ifdion –  Bodhitree Sep 3 '12 at 14:16
    
@Bodhitree you can put it inside or outside the ar2_setup() referring to @Brian 's comment. After you add the image size in functions.php, open the template you use for homepage & archive and replace the image size on the functions that call the post thumbnail with your new size. Last step, rebuild the thumbnails using this plugin –  ifdion Sep 3 '12 at 17:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.