How to Customize the Twenty Eleven Showcase Template: From Formatting to Post Display
Content
The Twenty Eleven theme's Showcase template is a powerful feature for creating a dynamic homepage. However, many users encounter common issues when trying to customize its appearance and behavior. Based on community discussions, this guide addresses the most frequent questions and provides solutions for tailoring the Showcase template to your needs.
Common Showcase Template Challenges
Users often report the following issues:
- HTML formatting (like bold or italics) being stripped from featured posts in the slider.
- Difficulty controlling the number of recent posts displayed.
- Needing to change the order of posts (e.g., chronological vs. reverse-chronological).
- Wanting to display posts only from a specific category.
- The "Recent Posts" section appearing where it's not wanted.
Solutions and Customization Methods
Important Note: The 'Twenty Eleven' team and the wider WordPress community strongly advise against editing the core Twenty Eleven theme files directly. Any modifications should be made in a child theme to preserve changes after theme updates.
1. Modifying the Number of Recent Posts
To change how many posts appear in the "Recent Posts" section below the slider, you must add a 'posts_per_page' parameter to the query in your child theme's copy of showcase.php.
// Display our recent posts...
$recent_args = array(
'posts_per_page' => 10, // Change this number
'order' => 'DESC',
... // other existing arguments
);
2. Changing the Post Order
To display posts in ascending (oldest first) instead of descending (newest first) order, modify the 'order' parameter in the same $recent_args array.
'order' => 'ASC',
3. Displaying Posts from a Specific Category
To filter the recent posts to a single category, add a 'cat' parameter with the desired category ID.
'cat' => '4', // Replace '4' with your category ID
4. Removing the "Recent Posts" Section Entirely
If your site is more static and you do not want the Recent Posts list to appear on your Showcase page, the most straightforward method is to comment out or remove the section of code in showcase.php that generates it. Look for the block of code that begins with // Display our recent posts... and remove it or wrap it in PHP comments (/* ... */).
5. Preserving HTML Formatting in the Slider
The stripping of style tags from the featured post excerpt is typically by design to maintain a consistent look in the slider. To override this, you would need to create a custom function in your child theme's functions.php file to modify the excerpt generation and allow specific HTML tags. This requires a more advanced understanding of WordPress filters.
Conclusion
Customizing the Twenty Eleven Showcase template is entirely possible through a child theme. The key is identifying the correct section of the showcase.php template file and modifying the WordPress query arguments to suit your needs. Always remember to use a child theme to ensure your customizations remain safe during future updates.
Related Support Threads Support
-
Font styles not appearing in Featured Post showcase templatehttps://wordpress.org/support/topic/font-styles-not-appearing-in-featured-post-showcase-template/
-
Length of post shown on Showcase pagehttps://wordpress.org/support/topic/length-of-post-shown-on-showcase-page/
-
[Theme: Twenty Eleven] auto-slidehttps://wordpress.org/support/topic/theme-twenty-eleven-auto-slide/
-
Showcase under one-column Twenty Eleven?https://wordpress.org/support/topic/showcase-under-one-column-twenty-eleven/
-
[Theme: Twenty Eleven] How to make a post Sticky or Featuredhttps://wordpress.org/support/topic/theme-twenty-eleven-how-to-make-a-post-sticky-or-featured/
-
More posts on Showcase Page?https://wordpress.org/support/topic/more-posts-on-showcase-page/
-
Showcase Template Width is too narrowhttps://wordpress.org/support/topic/showcase-template-width-is-too-narrow/
-
Featured posts not showing in Showcase-template in IE8https://wordpress.org/support/topic/featured-posts-not-showing-in-showcase-template-in-ie8/
-
[Theme: Twenty Eleven] How-To: Auto-advance TwentyEleven showcase slideshttps://wordpress.org/support/topic/theme-twenty-eleven-how-to-auto-advance-twentyeleven-showcase-slides/
-
How to hide RECENT POSTS ?https://wordpress.org/support/topic/how-to-hide-recent-posts/
-
More Showcase Template Questionshttps://wordpress.org/support/topic/more-showcase-template-questions/
-
[Theme: Twenty Eleven] Showcase: Display only the title and commentshttps://wordpress.org/support/topic/theme-twenty-eleven-showcase-display-only-the-title-and-comments/
-
[Theme: Twenty Eleven] Is it possible to have Featured Post without Showcase Page Template?https://wordpress.org/support/topic/theme-twenty-eleven-is-it-possible-to-have-featured-post-without-showcase-page-template/
-
Using the Showcase show just one categoryhttps://wordpress.org/support/topic/using-the-showcase-show-just-one-category/
-
show more recent articles in showcasehttps://wordpress.org/support/topic/show-more-recent-articles-in-showcase/
-
[Theme: Twenty Eleven] How do I get "Recent Posts" to stop appearing ?https://wordpress.org/support/topic/theme-twenty-eleven-how-do-i-get-recent-posts-to-stop-appearing/
-
[Theme: Twenty Eleven] Change post order in recent posts section of showcase template – how to?https://wordpress.org/support/topic/theme-twenty-eleven-change-post-order-in-recent-posts-section-of-showcase-template-how-to/
-
Exclude “Recent Posts” from page templatehttps://wordpress.org/support/topic/exclude-recent-posts-from-page-template/
-
Featured post aligned to the lefthttps://wordpress.org/support/topic/featured-post-aligned-to-the-left/
-
How to make custom posts stickyhttps://wordpress.org/support/topic/how-to-make-custom-posts-sticky/
-
Narrowing and floating the Featured Posts Showcasehttps://wordpress.org/support/topic/narrowing-and-floating-the-featured-posts-showcase/
-
Can't see the slider buttons and showing recent postshttps://wordpress.org/support/topic/cant-see-the-slider-buttons-and-showing-recent-posts-1/
-
[Theme: Twenty Eleven] featured posts full length??https://wordpress.org/support/topic/theme-twenty-eleven-featured-posts-full-length/