Skip to main content

Removing Image Sizes

Removing an image size can be handled through the child theme functions.php file.

  • 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 */
    // remove_image_size( 'portfolio-widget' ); 
	// 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 */
   // remove_image_size( 'large_featured' ); 
   // remove_image_size( 'medium_featured' );    
}

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 );   
	  
}