Twenty Twelve Featured Image Size

I have made a site using a child theme of Twenty Twelve.

I’m trying to make a change so that when the “Featured Image” is specified for a post it shows up above the post as a smaller size that the Twenty Twelve default of 624 px wide.

i have read about how to do this and got some advice from the WP support forum but I cannot get it o work.

I have a functions.php file in my child theme that contains only the following code:

<?php
if ( function_exists( ‘set_post_thumbnail_size’ ) ) {
set_post_thumbnail_size( 100, 100, true );
}

I think that should work, but it doesn’t. On advice from a well respected WP support forum regular I tried :

function my_theme_thumb() {
set_post_thumbnail_size( 100, 100, true );
}
add_action( ‘after_setup_theme’, ‘my_theme_thumb’ );

That doesn’t work either. For some reason the function always continues to use the parent Twenty Twelve featured image size of 624px wide. I’ve tried a bunch of other stuff but just can’t figure out how to get control of the Featured Image thumbnail size.

Any help or advice will be very much appreciated.

Could you link us to a page that has such an image on it, or specify an example of that image? You can set images sizes with CSS, so I was looking into that, but I don’t know what to look at.

Thanks for your reply Ralph. here is a link to a page of posts. The top image is set (in the WP dashboard) as the “Featured Image” for that post. My understanding is that the size of the “Featured Image” is controlled by a php function in the functions.php file, not really by css. I want to have my child theme functions.php file control that size (per WP best practice / recommended method). As you can see, the image is being shown at the parent Twenty Twelve functions.php default size of 624px wide. I can’t seem to add the correct code to my child theme functions.php… or perhaps there is some other problem with one other child theme template files.

http://www.telluridemountainclub.org/category/trip-report/

Yeah, I can’t help with the PHP bit, but you do have the option to do something like this in your CSS:

.entry-header img {width: 550px;}

Thanks but that will cause other problems in the WP functionality. There are other WP related things that acccess the Featured Image and it is possible, if one can only figure it out, to have it display at different sizes in different locations with in the site The way I’m trying to get this done is the recommended technique per WP codex and all best practice advice. I’m just not getting how to do it and need some WP specific help.

Thanks again!

Hey a helpful person on the WP forum provided the answer.

“It needs to hook in with later order, the default is 10, try 11.”

I needed to add an order number “11” to the function. See below.

function my_theme_thumb() {
set_post_thumbnail_size( 100, 100, true );
}
add_action( ‘after_setup_theme’, ‘my_theme_thumb’, 11 );

Now it works!

Thanks for posting the answer. I’m sure this will help out someone else some time. :slight_smile: