Skip to main content

Modify/Remove Image Sizes

Salient registers a set of image sizes of its own, so every upload is cropped into several versions. From a child theme you can remove the sizes your site never uses, or change the dimensions of the ones it does.

Removing Image Sizes​

  • Step 1: Open your child theme functions.php (salient-child/functions.php)
  • Step 2: Copy the snippet below into the bottom.
  • Step 3: Uncomment any image sizes you wish to remove from Salient by deleting the “//” at the beginning of the line.
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​

To alter a Salient image size, first remove the existing size and then register the new one. 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 );

}