How to Control Image Sizes and Cropping in the Twenty Fifteen Theme
Content
Many users of the Twenty Fifteen theme encounter issues with how their images are displayed. Common problems include unwanted cropping of featured images, confusion over which image sizes the theme actually uses, and header images not behaving as expected. This guide explains the theme's default image behavior and provides solutions for gaining more control.
Understanding Twenty Fifteen's Default Image Behavior
The Twenty Fifteen theme registers specific image sizes to maintain its design aesthetic. The most important ones to know are:
- Featured Images: The theme uses a cropped size for featured images with an aspect ratio of approximately 825px by 510px.
- Header Images: Header images are designed to be very large (e.g., 2000px wide) because only a vertical portion of them is displayed in the sidebar on desktop views.
- Content Images: The main content column has a defined width, which dictates the optimal width for images inserted into posts.
When you upload a new image, WordPress generates multiple thumbnails based on these registered sizes, which can lead to concerns about disk space if many unused sizes are created.
Common Problems and Their Solutions
1. Preventing Featured Image Cropping
A frequent complaint is that Twenty Fifteen aggressively crops the top of featured images to fit its 825x510 ratio. To prevent this and use your original image's aspect ratio, you can add the following code to your child theme's functions.php file:
function my_theme_setup() {
remove_theme_support( 'post-thumbnails' );
add_theme_support( 'post-thumbnails' );
}
add_action( 'after_setup_theme', 'my_theme_setup', 11 );
This code removes the theme's default thumbnail support and then re-adds it without the hard-coded crop, allowing your images to display in their original proportions, scaled to the correct width.
2. Making Featured or Content Images Full-Width
If your featured image or inline content images are not stretching the full width of the content column (and instead are only as wide as the text), you can use custom CSS. Add the following to the Appearance > Customize > Additional CSS panel:
.post-thumbnail img,
.entry-content img {
width: 100%;
}
This tells the browser to scale the images to fill 100% of the width of their container.
3. Reducing Unnecessary Thumbnail Generation
If you are using a plugin like Stop Generating Unnecessary Thumbnails or Disable Media Sizes to save disk space, you need to know which sizes to keep. For Twenty Fifteen, the essential image sizes are:
thumbnailmediumlargepost-thumbnail(the featured image size)
You can safely disable other sizes if they are not used elsewhere on your site. There are no known conflicts between these plugins and the Twenty Fifteen theme.
4. Finding the Correct Content Width for Optimization
To optimize your images, you should know the width of the content area. For Twenty Fifteen, the main content column is 826 pixels wide on standard desktop displays. Uploading images at or near this width can improve page load times and quality.
Conclusion
The Twenty Fifteen theme has specific design requirements that dictate its default image handling. While this can sometimes lead to unexpected cropping or sizing, using a child theme and the customizations outlined above provides significant control over how your images are displayed, allowing you to tailor the theme to your content's needs.
Related Support Threads Support
-
Image sizes used by or created by Twenty Fifteen?https://wordpress.org/support/topic/image-sizes-used-by-or-created-by-twenty-fifteen/
-
How to prevent twenty fifteen theme from cropping featured images?https://wordpress.org/support/topic/how-to-prevent-twenty-fifteen-theme-from-cropping-featured-images/
-
TwentyFifteen: Resize width of header imagehttps://wordpress.org/support/topic/twentyfifteen-resize-width-of-header-image/
-
How to change the default aspect ratio of featured images?https://wordpress.org/support/topic/how-to-change-the-default-aspect-ratio-of-featured-images/
-
twenty fifteen example theme – how to position image?https://wordpress.org/support/topic/twenty-fifteen-example-theme-how-to-position-image-1/
-
Image size issue after recent 2015 Theme updatehttps://wordpress.org/support/topic/image-size-issue-after-recent-2015-theme-update/
-
Optimal image size for theme twenty fifteenhttps://wordpress.org/support/topic/optimal-image-size-for-theme-twenty-fifteen/
-
Preload Largest Contentful Paint Imagehttps://wordpress.org/support/topic/preload-largest-contentful-paint-image-3/
-
How do header images function in Twenty Fifteenhttps://wordpress.org/support/topic/how-do-header-images-function-in-twenty-fifteen/
-
width featured imagehttps://wordpress.org/support/topic/width-featured-image/
-
Resize background for mobilehttps://wordpress.org/support/topic/resize-background-for-mobile/
-
2015 child: overhanging images?https://wordpress.org/support/topic/2015-child-overhanging-images/