pixelneer
pixelneer

Reputation: 155

Wordpress Custom Featured image size?

I have gone through each of the solutions I've found on here, and still cannot get my 'featured' image to show it's proper size, something continually is forcing it to the wp default 150x110 px.

I have gone into wp/settings/media and changed the thumbnail size... no change I have gone into the gallery/ featured image and turned off all other sizes except for original... no change I have gone into my functions.php file and changed the size that is supposedly being called..

if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'homepage-thumb' );
    set_post_thumbnail_size( 420, 110 ); // default Post Thumbnail dimensions   
}

if ( function_exists( 'add_image_size' ) ) { 
add_image_size( 'category-thumb', 420, 9999 ); //300 pixels wide (and unlimited  height)
add_image_size( 'homepage-thumb',420, 110, true ); //(cropped)
}

In my index file I have ...

<?php if(has_post_thumbnail()) {echo '<a href="'.get_permalink().'">';echo get_the_post_thumbnail($post->ID, array(420,110) );echo '</a>';} ?>

and still nothing..

When I inspect the element in firebug I see this:

<img class="attachment-420x110 wp-post-image" width="150" height="110" title="t-test2" alt="t-test2" src="http://pixelneer.com/wp-content/uploads/2012/01/t-test2-150x110.png">

SO it is still getting the defualt thunbnail size from somewhere else, and I am at a loss.

I am using starkers, and the URL is pixelneer

Upvotes: 1

Views: 15805

Answers (4)

bo4610
bo4610

Reputation: 1

Go to your functions.php and look for this code

add_image_size( 'properties', 280, 200, TRUE );

280 is the width and 200 is the height in pixel.

This should solve your problem

Upvotes: 0

Sean Hawkridge
Sean Hawkridge

Reputation: 57

You need to specify the size of the image by name when you call it, otherwise it will default to thumbnail size - like this:

<?php if(has_post_thumbnail()) {
echo '<a href="'.get_permalink().'">';
echo get_the_post_thumbnail( 'homepage-thumb' ); 
echo '</a>';} ?>

Upvotes: 0

GhostToast
GhostToast

Reputation: 467

When you call up the thumbnail, use the image_size name that you defined earlier. So for example instead of:

get_the_post_thumbnail($post->ID, array(420,110) );

Use:

get_the_post_thumbnail($post->ID, 'home-page-thumb' );

Upvotes: 5

Pekka
Pekka

Reputation: 449783

WordPress generates thumbnails only at the time of uploading of the image. Later changes in thumbnail sizes do not automatically apply to existing images.

Try re-uploading your image, or use a plugin like the Ajax Thumbnail rebuilder to rebuild.

Upvotes: 1

Related Questions