I’m encountering this very frustrating problem where add_image_size()
just doesn’t seem to work at all (in fact, I’ve never seen it even work before). By not working, I mean not resizing / crop (if I take away my CSS width / height, the thumbnail will be the exact size in which I have uploaded it).
I do have:
add_theme_support( 'post-thumbnails' )
add_image_size( 'small-thumb', 60, 60, true )
the_post_thumbnail( 'small-thumb' )
- And most importantly, yes I’ve been regenerating my thumbnails close to 50 times now after changing the
add_image_size()
and it’s not working.
Now I do have a question related to this problem: Does CSS styling like max-width
/ max-height
/ width
/ height
or anything effect WordPress’ thumbnail functions?
Anyone seem to know what else I can try to fix this?
Thanks
3 Answers
There are a couple of things to check here.
First, make sure that add_theme_support( 'post-thumbnails' )
is loaded before add_image_size( 'small-thumb', 60, 60, true )
You can always hook everything through a function to the after_setup_theme
hook. I always add these in my theme setup function
function wpse_setup_theme() {
add_theme_support( 'post-thumbnails' );
add_image_size( 'small-thumb', 60, 60, true );
}
add_action( 'after_setup_theme', 'wpse_setup_theme' );
Apart from that, everything should work if you call your post thumbnail correctly in the loop.
On your question
Does CSS styling like max-width/ max-height/ width / height or
anything effect WordPress’ thumbnail functions?
No, it doesn’t. CSS only manipulate how a thumbnail is displayed on the front end