Removing Image Sizes
- Step 1: Open your child theme functions.php (salient-child/functions.php)
- Step 2: Copy the below snippet into the bottom.
- Step 3: Uncomment any image sizes you wish to remove from Salient – you can do so by deleting the “//” from the beginning of the image size.
add_action( 'after_setup_theme', 'salient_child_remove_image_sizes', 11 );
function salient_child_remove_image_sizes() {
/* PORTFOLIO & IMAGE GRID SPECIFIC STYLES */
/* -- If you're not using a Portfolio element in your website,
you can safely disable these. -- */
// remove_image_size( 'portfolio-widget' );
// remove_image_size( 'portfolio-thumb' );
// remove_image_size( 'portfolio-thumb_small' );
// remove_image_size( 'portfolio-thumb_large' );
// remove_image_size( 'regular_small' );
// remove_image_size( 'regular' );
// remove_image_size( 'wide_small' );
// remove_image_size( 'wide' );
// remove_image_size( 'tall' );
// remove_image_size( 'wide_tall' );
// remove_image_size( 'wide_photography' );
/* GENERAL SIZES */
/* -- Used in Masonry Classic Enhanced blog style -- */
// remove_image_size( 'large_featured' );
/* -- Used in Auto Masonry blog style -- */
// remove_image_size( 'medium_featured' );
/* -- Used in WooCommerce Gallery Thumbnail -- */
// remove_image_size( 'nectar_small_square' );
}
Altering image sizes
Altering a Salient image size can be accomplished by first removing the existing image size and then registering the new size. Note that after the altered sizes have been registered, you will need to run the Regenerate Thumbnails plugin to recreate all of your existing images on the server in the new size.
// Alter image sizes
add_action( 'after_setup_theme', 'salient_child_remove_image_sizes', 11 );
function salient_child_remove_image_sizes() {
remove_image_size( 'regular' );
add_image_size( 'regular', 800, 400, true );
}