I see 2 problems in your last part.
- You didn’t add hook for the code. Without it, I doubt that the
add_image_size
function will be executed. I suggest you wrap it in another function and add toafter_setup_theme
hook withadd_action
function. - I think the way you use
function_exists
is unnecessary. With the way you set that conditional block, it will always true because add_theme_support is a built-in core function.
Here is my suggestion code.
if( !function_exists('theme_setup') ) {
function theme_setup() {
add_theme_support('post-thumbnails');
add_image_size('test', 260, 380, true);
}
add_action('after_setup_theme', 'theme_setup');
}
It’s actually quite common way to interact your theme/plugin with WordPress core.