I am using the custom-community (CC) theme I have created a sub-theme I have created a functions.php file
The original CC theme has this code in the functions.php
// This theme uses post thumbnails
if (function_exists('add_theme_support')) {
add_theme_support('post-thumbnails');
set_post_thumbnail_size(222, 160, true);
add_image_size('slider-top-large', 1006, 250, true);
add_image_size('slider-large', 990, 250, true);
add_image_size('slider-responsile', 925, 250, true);
add_image_size('slider-middle', 756, 250, true);
add_image_size('slider-thumbnail', 80, 50, true);
add_image_size('post-thumbnails', 222, 160, true);
add_image_size('single-post-thumbnail', 598, 372, true);
}
I want to change the post thumbnail size from 222x160 to a larger size, e.g. 400x300.
I have read the codex on Post Thumbnails, Function Reference/add image size, Function Reference/set post thumbnail size, Function Reference/the post thumbnail, Plugin API/Filter Reference.
Unfortunately my understanding of PHP is still very limited and I am in the early-learning phase.
I have seen examples of what sound like similar problems elsewhere for the twenty-ten theme, but nothing I can understand or apply myself without my functions.php locking me out, deleting it on ftp and starting again.
I am still unsure if it is possible to add a function to my sub-theme functions.php that will either unset/re-assign an image size for the thumbnail (or any other specified image type) in the parent theme.
To clarify that my functions.php and sub-theme are working correctly I can confirm that I have successfully used functions for styling my login, I just lack the understanding to achieve this myself.
Following the tuts-plus tutorial (Point 6 - Remove Additional Image Sizes) I tried the following code in my functions.php:
//change thumbnail size
function remove_parent_image_sizes( $sizes ) {
unset( $sizes['post-thumbnail-size'] );
return $sizes;
}
if ( function_exists( 'add_image_size' ) ) {
// 400 pixels wide and 300 px tall, cropped
add_image_size( 'post-thumbnails', 400, 300, true );
}
I then removed a featured image from a post and applied a new one but it still has the dimensions 222x160.
Still stumped :(
Also tried it this way but still no luck;
//change thumbnail size
function remove_parent_image_sizes( $sizes ) {
unset( $sizes['post-thumbnail-size'] );
return $sizes;
}
if (function_exists('add_theme_support')) {
add_theme_support('post-thumbnails');
set_post_thumbnail_size(400, 300, true);
add_image_size('post-thumbnails', 400, 300, true);
}
And adding this line (modified from the stackexchange link) to the end caused my site to break:
add_action( 'after_setup_theme', 'remove_parent_image_sizes' );