function custom_add_image_sizes() { add_image_size('gallery-size', 300, 300, true); // Cropped //add_image_size('custom-size-2', 800, 600, false); // Not cropped } add_action('after_setup_theme', 'custom_add_image_sizes'); function custom_filter_image_sizes($sizes, $metadata) { $image_width = $metadata['width']; $image_height = $metadata['height']; // Remove gallery-size if the image is too small if ($image_width < 300 || $image_height < 300) { unset($sizes['gallery-size']); } // Remove custom-size-2 if the image is too small //if ($image_width < 800 || $image_height < 600) { // unset($sizes['custom-size-2']); //} return $sizes; } add_filter('intermediate_image_sizes_advanced', 'custom_filter_image_sizes', 10, 2);
The Granite Church
Granite Church logo
Back To Top