How to Control Featured Images and Excerpts in the Twenty Twelve Theme
Content
Many users of the Twenty Twelve theme want more control over how their content is displayed. A common request is to show a featured image on archive pages (like the blog index or category lists) but hide it on single post pages, or to display post excerpts instead of full content. This guide will walk you through the most common solutions.
The Core Issue
The Twenty Twelve theme's default behavior is to display the featured image on both archive pages and single post views. It also shows the full content of a post on archive pages unless you manually configure excerpts. This setup doesn't suit everyone's design preferences, leading users to seek modifications.
Common Solutions
1. Using a Child Theme (Recommended)
The safest way to make these changes is by using a child theme. This protects your modifications from being overwritten when the parent theme is updated.
2. Hiding the Featured Image on Single Posts
To remove the featured image from individual post pages while keeping it visible on archive pages, you can add a simple CSS rule to your child theme's style.css file or the Customizer's 'Additional CSS' section:
.single .post-thumbnail {
display: none;
}
3. Forcing Excerpts on Archive Pages
To display post excerpts instead of full content on category and archive pages, you need to modify the theme's template files. In a child theme, copy the content.php file from the parent theme. Then, locate this line:
<?php if ( is_search() ) : // Only display Excerpts for Search ?>
Modify it to also target archive pages:
<?php if ( is_search() || is_archive() ) : // Only display Excerpts for Search and Archives ?>
4. Controlling the Excerpt Length
To change the default excerpt length, add the following code to your child theme's functions.php file:
function my_custom_excerpt_length( $length ) {
return 30; // Change 30 to your desired word count
}
add_filter( 'excerpt_length', 'my_custom_excerpt_length', 999 );
Important Considerations
- Plugin Conflicts: Some issues, like galleries not displaying correctly, are often caused by plugin conflicts (as seen in Thread 18). If you experience problems after installing a new plugin, try deactivating it to see if the issue resolves.
- Ask in the Right Place: For help with specific plugins (like the 'display-posts' shortcode in Thread 6), always seek support in that plugin's dedicated forum, not the theme's.
- Backup First: Always back up your site before making changes to theme files.
By following these steps, you can gain greater control over how your Twenty Twelve theme presents your content, creating a more tailored experience for your visitors.
Related Support Threads Support
-
Show just one image on blog view, all images on posthttps://wordpress.org/support/topic/show-just-one-image-on-blog-view-all-images-on-post-1/
-
Ad a picture loophttps://wordpress.org/support/topic/ad-a-picture-loop/
-
Horizontal scroll photo gallery on Mainpagehttps://wordpress.org/support/topic/horizontal-scroll-photo-gallery-on-mainpage/
-
Main Page Post Imagehttps://wordpress.org/support/topic/main-page-post-image/
-
Display posts not showing >200https://wordpress.org/support/topic/display-posts-not-showing-200/
-
Post excerpt thumbnail first picturehttps://wordpress.org/support/topic/post-excerpt-thumbnail-first-picture/
-
Remove the feature image from posthttps://wordpress.org/support/topic/remove-the-feature-image-from-post/
-
Featured Image link to posthttps://wordpress.org/support/topic/featured-image-link-to-post/
-
Thumbnails on Searchhttps://wordpress.org/support/topic/thumbnails-on-search/
-
open images in another pagehttps://wordpress.org/support/topic/open-images-in-another-page/
-
Excepthttps://wordpress.org/support/topic/except/
-
making featured image clickablehttps://wordpress.org/support/topic/making-featured-image-clickable/
-
need code helphttps://wordpress.org/support/topic/need-code-help-1/
-
how to create slideshowhttps://wordpress.org/support/topic/how-to-create-slideshow-1/
-
Gallery Saveshttps://wordpress.org/support/topic/gallery-saves/
-
one half display on post/indexhttps://wordpress.org/support/topic/one-half-display-on-postindex/
-
Home – only the thumbnails, and single – just the normal post-image?https://wordpress.org/support/topic/home-only-the-thumbnails-and-single-just-the-normal-post-image/
-
How to show capsules instead of full articles on Posts Page?https://wordpress.org/support/topic/how-to-show-capsules-instead-of-full-articles-on-posts-page/
-
Blog Page: remove post summary text and only display mediahttps://wordpress.org/support/topic/blog-page-remove-post-summary-text-and-only-display-media/
-
featured image only instead of galleryhttps://wordpress.org/support/topic/featured-image-only-instead-of-gallery/
-
Links instead of full postshttps://wordpress.org/support/topic/links-instead-of-full-posts/
-
Added Fancy Box & Now Slideshow No Longer Option in Photo Galleryhttps://wordpress.org/support/topic/added-fancy-box-now-slideshow-no-longer-option-in-photo-gallery/
-
Remove Featured Image on Single Posthttps://wordpress.org/support/topic/remove-featured-image-on-single-post/
-
Feature Images before titlehttps://wordpress.org/support/topic/feature-images-before-title/
-
How to hide featured image in spine theme??https://wordpress.org/support/topic/how-to-hide-featured-image-in-spine-theme-1/
-
Front Page – Latest Posts: How to show only the latest post (not all)https://wordpress.org/support/topic/front-page-latest-posts-how-to-show-only-the-latest-post-not-all/
-
Show up all comments when open posthttps://wordpress.org/support/topic/show-up-all-comments-when-open-post/
-
Customize Blog Page Excerptshttps://wordpress.org/support/topic/customize-blog-page-excerpts/
-
Excerpt Page | Full post Pagehttps://wordpress.org/support/topic/excerpt-page-full-post-page/
-
Videos not displayed in excerptshttps://wordpress.org/support/topic/videos-not-displayed-in-excerpts/
-
setup excerptshttps://wordpress.org/support/topic/setup-excerpts/
-
featured images | always shown together with entire posthttps://wordpress.org/support/topic/featured-images-always-shown-together-with-entire-post/
-
Single Post not displaying contenthttps://wordpress.org/support/topic/single-post-not-displaying-content/
-
Gallery Order and Image Attachment Order Messes Uphttps://wordpress.org/support/topic/gallery-order-and-image-attachment-order-messes-up/
-
Custom gallery & image attachment templatehttps://wordpress.org/support/topic/custom-gallery-image-attachment-template/