Troubleshooting Twenty Twelve Featured Image Issues: Crops, Placement, and Sizes
Content
Featured images are a powerful part of the Twenty Twelve theme, but they can sometimes be a source of confusion. Based on community discussions, common problems include cropped thumbnails not displaying correctly, images appearing in the wrong location, or unexpected image sizes being generated. This guide consolidates the most frequent issues and their solutions.
Common Featured Image Problems and Solutions
1. Thumbnail Crop Not Applying on the Front End
The Problem: You crop a thumbnail using the 'Edit Image' tool in the Media Library, and the admin area preview looks correct. However, the public-facing site continues to show an uncropped, resized version of the original image.
The Solution: This is often a caching issue. After cropping and saving the image, clear any caching plugins you have installed on your site. Additionally, perform a "hard refresh" in your browser (Ctrl + F5 on Windows, Cmd + Shift + R on Mac) to bypass the browser's cached version of the page.
2. Unwanted Extra Image Sizes Being Generated (e.g., 1536px)
The Problem: WordPress core, not the Twenty Twelve theme, automatically generates additional image sizes for use in responsive 'srcset' attributes. This is normal behavior designed to serve optimally sized images to different devices. The '1536px' size is one of these default sizes.
The Solution: It is not recommended to disable this core functionality as it improves site performance and user experience. If disk space is a concern, consider using a plugin specifically designed to manage image sizes, but be aware this can negatively impact how images look on various screens.
3. Featured Image Appears Twice or in the Wrong Place
The Problem: After a theme update, a featured image may appear both in the post content and in a custom banner area, or you may want to move its location (e.g., to the left of a post title).
The Solution: The correct method for controlling the display of the featured image is by using a child theme. Never edit the parent Twenty Twelve theme files directly, as your changes will be lost during updates.
- To Remove the Featured Image from Single Posts: In your child theme's copy of
content.php, find the line<?php the_post_thumbnail(); ?>and comment it out by changing it to<?php // the_post_thumbnail(); ?>. - To Center a Featured Image: The image has
display: inline;by default, somargin: 0 auto;will not work. Instead, add the following CSS to your child theme'sstyle.cssfile or a custom CSS option:.entry-header { text-align: center; } - To Position a Thumbnail to the Left of a Post Title: Add this CSS to your child theme:
.entry-header .entry-title { display: inline; }
4. Changing the Default Featured Image Size
The Problem: The default featured image size in Twenty Twelve is 624px wide with unlimited height. You want to change this to a custom dimension.
The Solution: Add the following code to your child theme's functions.php file. Replace the width and height values with your desired dimensions.
function my_child_theme_setup() {
set_post_thumbnail_size( 800, 400, true ); // True enables hard cropping
}
add_action( 'after_setup_theme', 'my_child_theme_setup', 11 );
Important Note: This change will only affect images uploaded after the code is added. To apply new sizes to existing images, you will need to use a plugin like "Regenerate Thumbnails."
5. Featured Images Not Working on Pages
The Problem: The Twenty Twelve theme is designed to display featured images on standard blog posts, not on pages. While the option to set a featured image for a page exists, the theme's template files do not include the code to display it.
The Solution: To display a featured image on a page, you must modify your child theme's page template (page.php). You would need to add the function the_post_thumbnail(); in the desired location within the template's code.
Best Practices
- Always Use a Child Theme: This is the most important rule. A child theme protects your customizations from being overwritten when the parent Twenty Twelve theme receives an update.
- Clear Caches: Many featured image display issues, especially after making changes, are resolved by clearing browser, server, and plugin caches.
- Facebook Sharing: If Facebook grabs the wrong image (like a header) when sharing a post, use the Facebook Debugger tool to clear its cache and specify which image to use.
By following these troubleshooting steps, you can resolve the majority of featured image issues encountered in the Twenty Twelve theme.
Related Support Threads Support
-
EditMedia>ThumbnailCrop>Not Working?https://wordpress.org/support/topic/editmediathumbnailcropnot-working/
-
Extra image generation when uploading imagehttps://wordpress.org/support/topic/extra-image-generation-when-uploading-image/
-
Header Image shows up twicehttps://wordpress.org/support/topic/header-image-shows-up-twice/
-
Remove Feature Image from Above Post in Twenty Twelvehttps://wordpress.org/support/topic/remove-feature-image-from-above-post-in-twenty-twelve/
-
Deleted version of image (same name) still showing up in postshttps://wordpress.org/support/topic/deleted-version-of-image-same-name-still-showing-up-in-posts/
-
Centering Featured Images in Postshttps://wordpress.org/support/topic/centering-featured-images-in-posts/
-
Center Featured Imagehttps://wordpress.org/support/topic/center-featured-image-1/
-
Featured image on tag pagehttps://wordpress.org/support/topic/featured-image-on-tag-page/
-
Re-size Single Image on Posthttps://wordpress.org/support/topic/re-size-single-image-on-post/
-
Featured Image refuses to go full-width.https://wordpress.org/support/topic/featured-image-refuses-to-go-full-width/
-
Change 300×225 Thumbnail Sizehttps://wordpress.org/support/topic/change-300x225-thumbnail-size/
-
Twenty Twelve – removing drop shadow from a selected single featured imagehttps://wordpress.org/support/topic/twenty-twelve-removing-drop-shadow-from-a-selected-single-featured-image/
-
Setting type of featured imagehttps://wordpress.org/support/topic/setting-type-of-featured-image/
-
how to change featured image locationhttps://wordpress.org/support/topic/how-to-change-featured-image-location/
-
posted link in Facebook shows header imagehttps://wordpress.org/support/topic/posted-link-in-facebook-shows-header-image/
-
Thumbnail/featured image to the left of blog post titlehttps://wordpress.org/support/topic/thumbnailfeatured-image-to-the-left-of-blog-post-title/
-
Remove featured image on post, but not on front pagehttps://wordpress.org/support/topic/remove-featured-image-on-post-but-not-on-front-page/
-
featured images generation eliminationhttps://wordpress.org/support/topic/featured-images-generation-elimination/
-
Change featured image sizehttps://wordpress.org/support/topic/change-featured-image-size-12/
-
Featured Image for Pages not working (not Posts)https://wordpress.org/support/topic/featured-image-for-pages-not-working-not-posts/
-
Featured Image for Pageshttps://wordpress.org/support/topic/featured-image-for-pages/
-
Blurry thumbnails in mobile sitehttps://wordpress.org/support/topic/blurry-thumbnails-in-mobile-site/
-
featured images creeping back in – why?https://wordpress.org/support/topic/featured-images-creeping-back-in-why/