As you probably already know, WordPress has announced it’s third release candidate for version 3.2, while the actual release is being delayed for a few days. You might be familiar with some of the new features coming up in 3.2, but we have a dedicated blog post for that lined up. This post is about the new default theme in WordPress 3.2 — Twenty Eleven.
This is the second year in a row that WordPress is changing their default theme, which is a good trend and we’re obviously hoping to see Twenty Twelve next year ;) In this post I’ll give you a short intro to the Twenty Eleven theme and the functionality it provides. We’ll talk a little bit about post formats, layouts, color schemes and the theme options. We’ll then dive into the code of Twenty Eleven and see how the theme development guidelines have changed since last year’s Twenty Ten.
A Brief History: Duster & Twenty Eleven
Twenty Eleven wasn’t always named “Twenty Eleven”, before becoming the default WordPress theme it’s name was Duster. Duster was developed by the Automattic team, which is why it’s so exciting to WordPress developers.

Duster was first introduced to the WordPress.org directory for approval in mid-February this year, that’s around 4 months ago. There was a total of six versions of Duster, most of which implemented small fixes to quite crucial (although recommended, not required) elements to get past the theme reviewers team. Now this is interesting, unless we have missed something — it seems that Automattic is not taking any short cuts here either, they’re running their works through the review process just like everybody else is.
The final version of Duster (1.0.5) was approved in April, which is when it moved directly into the WordPress.org themes repository. Soon after that, Matt Mullenweg had imported the Duster theme to the WordPress core project as a candidate for Twenty Eleven, along with a few suggestions on how the theme could be better. That’s when Duster became “Twenty Eleven” and when the rest of the WordPress.org team started contributing.

Duster is still available in the free themes directory as well as for WordPress.com hosted web sites. Of course we can expect further improvement of that, or perhaps a merge after the 3.2 release.
A Quick Overview of Twenty Eleven
Sticky featured posts, lovely large images and typography at it’s best! And what’s more exciting is that the Automattic team has shown us the correct way of doing that, which we’ll dig into very soon.
Like many good themes, Twenty Eleven is ready for translation with right-to-left languages support. It’s got a great support for the visual editor CSS which makes content editing even more comfortable. It’s got support for background colors and images, and a very neat support for header images, which in my opinion, really took Twenty Ten forward.
The navigation menu and the widgets are there of course, nicely laid out with five different sidebar areas. So, quick question — isn’t it time to get rid of the word “sidebar”? Especially since the new default theme has three widgetized footer areas, it stops making sense these days doesn’t it? ;)
Now the most exciting admin feature is of course the Theme Options page. I think Automattic really nailed it this time, and would probably convince theme developers as well as companies to stop making fuzzy theme options screens, since everything can be so nicely done in the generic way, which is much more user friendly. Twenty Eleven’s Theme Options page lets you customize the default page layout, color scheme (dark or light) and the color of your links — fantastic!
Twenty Eleven comes with a couple of pre-made page templates, but don’t forget that you can always create your own child theme to override the different aspects of Twenty Eleven. And that would be a piece of cake, since the theme’s code is so nice and clean, really! And now, speaking about code, get your brains ready to dive into that.
Diving into Twenty Eleven
If you’re a theme developer and had your own best practices, frameworks and ideas of how things should be done with WordPress, I want you to forget them for a moment. Twenty Eleven really does show you the best coding practices of creating neat and shiny, child-compatible, awesome to read themes that use WordPress at it’s max.
The functions.php File
You probably already know what the functions.php file does. Twenty Eleven ships with an awesome, easy to follow functions file. It utilizes the after_theme_setup action to do the rest of the theme setup, which you should probably note down. It’s a bad idea loading that much stuff during init.
Localization, editor styles, the right way to include additional source code in your functions file, navigation menus, post formats, backgrounds, header images, thumbnails and more. It’s all in there, except for the sidebars registration. Sidebars are registered in a different action called widgets_init — which certainly is the right choice.
Read throughout the file very carefully and I’m sure you’ll learn a bunch of stuff. function_exists calls allow you to override functions in your child themes, i.e. using the same function names in your child theme will prevent Twenty Eleven from declaring (or re-declaring) the same functions. This is one of the many ways child themes can benefit from Twenty Eleven’s coding style.
Watch how Twenty Eleven escapes strings using esc_url, esc_html and esc_attr — you should probably follow that convention. Also note how the theme uses printf with placeholders to maintain very good readability of the theme’s code, as well as provide more flexibility to theme translators.
The content.php and content-*.php Files
You might be wondering what those files are doing there, right? We’re used to using the WordPress loop (aka The Loop) in our main template files across the template hierarchy (index.php, single.php, etc). This approach is not new to WordPress and it’s mainly implemented for child themes to take advantage of your theme.
This means that The Loop is replaced with calls to get_template_part, like so, in Twenty Eleven’s index.php:
// Inside the loop get_template_part( 'content', get_post_format() );
The second argument of the get_template_part function will return the current post’s “post format” — gallery, image, video or audio (introduced earlier in WordPress). The first argument is always the fallback for all. This means that it’s a safe way to run different files whether they exist or not, falling back to content.php. Let me explain… in code:
// Will include the content.php file from the template directory get_template_part( 'content' ); // Will attempt to include content-something.php from the // template directory, and will include content.php if the // former does not exist get_template_part( 'content', 'something' );
So the method illustrated in Twenty Eleven’s index.php will attempt to include content-post-format.php where post-format could be gallery, image, audio, status, video and more. If for some reason such a file is not found, it will always fall back to including content.php. That’s why you’re seeing a bunch of content-*.php files in the theme folder, but not all.
With this approach, child themes can override the behavior by simply providing a content-post-format.php file, and as you might know, WordPress will try to use the child theme’s file first, and then fall back to the parent if the child theme does not have one. You can even override the fallback content.php with your own.
The approach might be familiar from the loop.php method used in Twenty Ten, which is very similar, but called differently. I know people are now used to calling them the loop files, and some have even written books using that terminology. The truth is that get_template_part will accept any string for the file name, unless of course they’re reserved by the hierarchy.
Header & Footer Files
The header.php file has an awesome HTML5 browser support snippet which is ready to copy-paste to your own themes if needed. The rest is pretty simple and straightforward. Just note that get_template_stylesheet_directory is not used any more, this again is because of the great support for child themes. Also note how the wp_nav_menu together with the theme’s stylesheet have a good fallback for the wp_page_menu for when navigation menus are not used in the admin.
The footer.php is even simpler — show the footer widgets and then the footer itself. What’s interesting here is that there’s an action there called twentyeleven_credits, meaning that with a simple add_action call we can sort of inject stuff into that section, right before the WordPress credits are output.
That could be done in child themes or even plugins, without having to modify any piece of the Twenty Eleven code, and without even having to override the footer.php file in your child theme. Beautiful, isn’t it?
Stylesheets and the Rest
Not the best stylesheet in the world, especially with the lack of comments. Not a problem at all, since with today’s debugging tools for Firefox and Chrome, it’s quite easy to change stuff in your stylesheet, although that might create some redundant code, and maybe some minor browser compatibility issues depending on what you’re trying to change or override.
Don’t forget that child themes carry their own stylesheet and the parent’s stylesheet is not included unless you explicitly ask for it with the CSS @import directive. That only applies to themes that provide child theme supports. Older themes like to link to the stylesheet directly in their header.php file.
The rest.. Well one more thing worth mentioning here is how the whole theme files are structured. Very nicely bundled, folders with descriptive names, languages and images, colors and javascripts. A separate inc directory for the theme options code, layout and javascript, which is a bright idea as well.
What Did We Learn from Twenty Eleven
We at Theme.fm have learned quite a lot of things there. In fact, Twenty Eleven has even changed our mindsets a little bit, about code structuring, and child themes support. The main point though, remains the Theme Options layout — keep it dead simple, don’t offer too many options and use the WordPress approach, so that people wouldn’t have to learn new ways to interact with WordPress themes whenever they install a new one. This applies both to free and premium themes, in and out the WordPress.org repository. Here’s an example of a custom theme options page:
So no more fancy buttons, fancy tabs, custom tables and typography in the admin panel? Well it’ll be difficult to get rid of those, especially for companies like WooThemes, who have crafted their frameworks with the admin extensions built in. I don’t think that WooThemes will step away from that, but my personal opinion is that they should.
What About You?
Tell us how you see the Twenty Eleven theme and the WordPress development trends these days. What do you think about providing Theme Options in a WordPress or custom way (a good post by Ryan on WPCandy about this), and how do you see the parent-child model now that it’s becoming more and more popular?
Use the comments section below to share your thoughts, and don’t forget to stay tuned to Theme.fm via our RSS feed. Cheers, and happy Twenty Eleven! ;)






Thanks for great article, I always like good info about “best practices” :)
You’re welcome Ivan, thanks for your support. We’re only starting with this, we have some more great free and premium theme reviews lined up. So there’s so much to learn from the best developers in town (in the WordPress town of course).
Really great review. Thanks. I’ve only had a quick look at Twenty Eleven while I’ve been playing around with the 3.2 RC’s, but from what I’ve seen, it looks pretty sweet! Both Twenty Ten and Twenty Eleven have been a huge improvement over the old default themes that came with WP.
Thanks Anthony, glad you loved the review. We too are glad that Automattic has initiated this “every major comes with a new default theme” tradition :)
I’m working on a new WordPress site for a church and am using Duster. I’m not a developer, nor IT guy. I was wondering if it’s worth activating Twenty Eleven. I can’t quite see any major benefits to it over Duster, other than a few more color/layout options. Or am I missing something? Would you recommend moving to Twenty Eleven?
Denzil, as you mentioned, the difference between Twenty Eleven and Duster is minor. I would suggest you try both on your local environment and pick the one that suits you best. You’re not missing anything big by running one or the other, besides, if you’re building a child theme it doesn’t really matter ;)
Awesome writeup on this really awesome new Theme. I’m looking so much forward to the 3.2 Official release. Thanks for sharing these insights with us Konstantin.
Would be great to get a nice tutorial on creating child themes with Twenty Eleven. I’ve only ever created child themes using the Genesis Framework, does Twenty Eleven have similar Framework appeal with hooks and actions etc?
Thanks for the support @nomadone, hope your upgrade went well. We’re thinking of a short writeup about child theming Twenty Eleven, but there’s nothing really special about it other than that it’s perfect for child themes. I don’t think it’s as extensive as the Genesis Framework, although I didn’t use that myself yet, but as @Stuey pointed out, you can override any of the template files, including functions.php and add your own hooks where you need them. Cheers!
Pingback: Everything we know about the newly released WordPress 3.2 | WPCandy
I may give twentyeleven a try, but it looks like it will be a total pain to convert the main aspects of my twentyten child theme over. That the css sheet is double the length won’t make things any easier to pour through.
There are also quite a few fundamental differences compared to twentyten and other themes that will at the very least present a challenge to get used to. For one, there are multiple H1 tags.
Nomadone, child-theming is pretty much the same for twentyeleven/ten as it is for a framework. If you find that you need more hooks than are available, you can overright the entire template page with a child template, and add in the hooks yourself.
@Stuey I don’t think you should convert your Twenty Ten child to a Twenty Eleven child just for the sake of being Twenty Eleven. You see, Twenty Eleven is not a new version of Twenty Ten, it’s a totally different theme, they just have similar names. And they ship together too, so you should use the one that suits you best design- and functionality-wise.
So if your current child theme works good on Twenty Ten then leave it that way. Twenty Ten is a great theme as well and I’m quite sure it will stay up to date with the new comings in WordPress.
Oh, I agree, change for the sake of change is never a good idea. But I’ve been planning a few theme changes anyways, and could never find a base theme as suitable as twentyten thus far. A few of the twentyeleven features do interest me, and the HTML5 changes, including the multiple H1 markups, may have SEO benefits. At the very least, it looks to be more future-proof. Trying to work some of the new WordPress 3.2 features enabled by the twentyeleven theme into the twentyten theme may be more complicated than just transposing my customizations between themes.
Although I failed to mention it in my first comment, I agree that the post is well-written and pretty helpful. =)
Hi,
I am not a technical guy.
Since I updated to WP 3.2, I have been customizing the Twentyeleven theme for around 5 hours.
Then almost accidentally I have read in several places that I should not make customizations on this theme, as every time the WP version is upgraded, the changes I made will be lost.
Could you please recommend me a good/clear Tutorial about creating a child theme from TwentyEleven?
Thanks a lot in advance!
Kind regards
Alex
Hey Alex, sure thing! What you’re looking for is called child themes. We have reviewed an awesome book about creating themes for WordPress that covers child themes quite nicely. You might want to get a copy, you won’t regret it. Cheers!
Great post Konstantin! I’m a big advocate of Twenty Eleven, I think it’s a massively leap forwards in terms of a default theme. The only thing I would say that is missing is the ability to add a sidebar into posts. I can understand why they decided not to include this functionality, but I know many people will boycot the theme for that reason alone.
For those wondering how to how to create a child theme for twenty eleven check out this post: http://futurewebblog.com/add-sidebar-support-posts-twenty-eleven-theme/
It’s not exactly an example of how to create a child theme, but it does cover a few of the steps involved and also includes some code examples.
Thanks for your comment Chris. And great post regarding sidebars too, I agree with you that it’s one of the things they should have considered adding support for in Twenty Eleven, but not a rule-breaker for that matter and I wouldn’t say it’s fundamental to show 3.2′s abilities, which is what the default theme is all about, isn’t it? ;) Cheers!
Really great review. As a non-developer/programmer, it’s really given me a good idea of what i need to be doing to develop my own theme utilizing the solid framework of Twenty Eleven. Thank You. I feel i may be visiting this site more and more as i take on the task of learning WordPress :)
Thank You!
Thanks for your kind words Mark. It’s good to know people are actually learning something from our posts. Stay tuned for more great theming stuff and thanks for being with us :) Cheers!
Pingback: WordPress 3.2 Released: Faster, Prettier, Powerful « Lorelle on WordPress
Great post!!. After reading this post I was able to modify the how posts are displayed under categories and archive. It took me less than 10 mins after getting the foundation from this post. I created a post in the event someone wants to customize a blog in a similar manner. See http://omarfrancisco.com/wordpress-twentyeleven-theme-taming-category-and-archive/ Keep up the good work.
Thanks Omar, your post looks cool, thanks for the heads up ;)
Pingback: WordPress TwentyEleven Theme – Show Only Sticky Posts In Home Page | Omar Francisco
Nice reviews of Twenty Eleven theme :)
Thanks Rilwis!
There are a lot of really awesome wordpress themes, especially those who make you forget that wordpress is a blog. But it seems developers only view on those who start a new project. Blogs with many thousands of articles and to change the theme can be a real torture. Pics don’t appear anymore, have to be resized, formatting of sections, sub-sections, paragraphs, sub-paragraphs, clauses, etc.
Therefore I took to Twentyeleven – it is latest php software skill, fully cooperates with the wordpress’ engine, big wordpress community who will digg further and at the same time no worries that thousands existing articles get messed up.
Of course if developers would make an ad, “You have a wordpress blog with 5000 articles and securely want to move to Ultimate WordPress Theme Prestige – with all kind of fancy code…”, I might get weak…;-)
Thanks for your comment Lenny. You’re right about migrating to a new theme, might be tough when they offer different options in different ways, especially with custom post types around. Before it was only posts and pages, migration was a simple matter of regenerating your thumbnails :)
Cheers!
Hello all. Thank you for the review and to everyone for sharing their views on this theme. I feel I must put my 2 cents in. I develop new themes and functions for my clients with WordPress 3.x and when I saw the new theme name, TwentyEleven, I, like most people, assumed this was an improved version of TwentyTen and found out in a very hard way that it is not. Shame on the WP dev team for this faux pas in basic best practices in naming convention. It steps over the line of Bait-n-switch.
The first thing you need to realize is that widgets may not get handled in the way you are accustomed to. In TwentyTen with the plugin “Widget Logic” (for instance) I could control when and where my widgets appeared; not so in TwentyEleven. Twenty Eleven doesn’t allow any widgets to appear in the side for some pages and category pages. Widget Logic is no longer in control. The reasoning behind this seems to be that widgets slow down page load and this hurts page rank. I personally say hogwash. I’m fairly certain that whatever content the user wanted to display in the widgets will just get moved into the main content and so where is the load time savings? BTW, widgets do get loaded into the landing page (I usually set a page as my home page instead of the default post loop) which is the first page a bot will hit! What if I don’t want this feature and want control over widgets returned back to me? According to what I have seen so far, you are stuck with it unless you want to use a different theme. Would be nice if they could make this a selection in the dashboard. Speaking of load times, the dev’s wanted to shorten load times so they doubled the size of the style.css?
All in all, I already had three days invested in the project using the TwentyEleven theme BEFORE I knew about the widget issue and I ended up tweaking the footer widget area in order to complete my project. Lesson learned: I will always fully vet a theme from now on before I start developing with it.
Even though I don’t think I will be using TwentyEleven again, I agree with the fact it has shown me a few things about child themes.
Hi Marc, your 2 cents looks like all 4! ;) Great comment and I couldn’t agree more on the widgets issue but my personal thought is that widgets have to either go, or receive a major rehaul, starting at the very roots — “the sidebar”. I wish page template can define “sidebar areas” where while editing the page content, I can also squeeze in a copule of widgets. Complex themes nowadays can define up to a couple dozen sidebar areas, that’s a total madness to manage, and yet, there is no easier standard way yet.
Let’s hope for the best for both Twenty Ten and Twenty Eleven, and oh well, Twenty Thirteen too ;)
Cheers and thanks again for dropping by!
Thank you Konstantin for this thoughtful & insightful writeup.
Like you, we cracked open Twenty Eleven and fell in love immediately. Automattic and WordPress.org folks did something extraordinary with this one.
Our one question is around file organization. What are your thoughts on where they chose to locate various files? For example, the stylesheets: there is of course the main style.css in the root level, a well understood and accepted (however contested) pattern for WordPress. But from there the opportunity to demonstrate an ideal organizing scheme seems to break down. There is a dedicated css folder, with only reset.css in it. The sample alternative color scheme “dark.css” resides in /colors. And then the separate visual editor style files for ltr and rtl both livein root. Given the way these sheets are called into WordPress it seemed as though they could’ve stuck with what seems to be convention in modern web design: collect all stylesheets in a single directory. Grouping files like this even works with child theme, provided the child theme mirrors the directory structure and follows how such resources are called in to the child theme. This is a nit-picky critique and almost certainly a little OCD, but why have 5 sheets living in three directories?
We also hoped you’d say a word or two regarding their extraordinary implementation of responsive web design through fluid-width media queries. It is among the better examples of fluid-width responsive out there and seems to work in all cases across all browsers out of the box, a remarkable achievement.
Thank you again,
jase
Hey Jase,
Thanks so much for your comment. I agree with your concerns about the file structure, but keep in mind that rtl.css and style.css have to be in the theme root directory as defined by WordPress, just like the editor-style.css, so some of these issues have to be solved at the WordPress level, which at this point isn’t a very easy task to do keeping in mind backwards compatibility.
So I guess that the css directory was intentionally created for child themes to replicate the file structure and have their extra CSS there, and the colors directory for different color layouts. A good example is when somebody would like to include a jQuery plugin for lightboxing galleries, those come with CSS files and javascript files for the js directory too. And the colors directory is to keep the color schemes out of the main theme CSS and images. I’d actually suggest giving that another directory, one per color scheme as each scheme can have its own files. Got an example right here.
Let me know if you have any questions.
~ K
Hi Konstantin thank you for your replies. San Fran seems like a wonderful project – great idea on OOP functions!
Since add_editor_style accepts a string representing the editor style file relative to theme root (with default being ‘editor-style.css’, it is possible to include a subdirectory in this string to tell the function file name and location. For example, add_editor_style(‘/css/editor-style.css’) works just as well in practice, and is still over-loadable by child theme in this way, provided child theme sticks to the /css directory. The same is true of some template tags like get_template_part(). Doing this works great and allows for consistent organization, although it might raise issues when it comes time to submit to the WP theme repository. It definitely causes an issue for the built in theme editor, which still does not show files in subfolders (even though this was supposedly patched 2 years ago)!
Thank you,
jase
Hey Jase. Thanks for the San Fran kudos, it’s still up in the review queue so stay tuned for an announcement. You’re right about editor style, then again, I don’t think you’ll have any trouble getting through the WordPress.org repository if your file structure is clean and shiny, right? If for some reason your neat trick doesn’t pass theme-check, you can always grab Otto or Chip to help you through.
Anyways, although Twenty Eleven is by far one of the best themes we’ve seen, it’s not perfect, but updates are issued to it constantly as you will see with WordPress 3.3 — Twenty Eleven is getting a Settings API rehaul, that way our child themes can actually expand on the Theme Options screen to ad our own to the list, got a great writeup on this planned ;)
If you’re aware of a known issue (theme editor) you should submit it to the WordPress Trac and have a chat about it on the #wordpress-dev IRC channel on Freenode, they’ve plenty of room for bug fixing, maybe a unit test there too if appropriate, that way it will never get broken :)
Cheers and thanks for your comment!
Regarding their responsive layout, well that’s done very professionally. We ourselves don’t fully understand how they came up with the brilliant code, but one suggestion we gave was move the code that starts after “Responsive Structure” to a different stylesheet or stylesheets and use the link tag with the media attribute to include them. Then again, this might create problems with child themes overriding the header template, so I personally think that it was a well-thought out decision ;)
Achievement was remarkable, totally with you there :)
K
I want to use the Twenty Eleven theme for a small business website, not a blog. Is there a way to get rid of the posts and the comments areas on my pages?
Nocile, with a child theme, yes, check out our child theming Twenty Eleven article for more info!
How difficult is it to add a second sidebar to make pages and posts with a sidebar-content-sidebar layout? I was thinking of Twenty Eleven as a framework ripe for customizing. That is the whole point of child themes.
Ken, you can override the sidebar.php template and add two sidebars then use CSS to style and position them accordingly. Be careful though, since Twenty Eleven has a responsive layout you’ll have to measure things in
emand percentages instead of pixels or points. Test the theme on several devices and different screen widths to see how it responds before being sure that “it is now three-column”.Hi Konstantin. Thanks for that incredible post! I was exactly looking for this conversation. I’m thinking about using Twenty Eleven as a start for developing a personal theme. Would you think it is a solid one to start up with? Or, would your recommend some others for a more solid start?
Thanks again! :)
Lilly, you’re welcome and yes, Twenty Eleven is a great one to start with. Actually I still think I haven’t seen any code better than in Twenty Eleven, even on the premium side so waiting for Twenty Twelve now too ;)
I’m about to start a new project and Googled “thematic vs twentyeleven” – which led me to this article. Thanks for the informative post – I’ve used Thematic previously, but I’ll give twentyeleven a chance this time around. Thanks for the tips!
You’re welcome Paul, and thanks for the
after_setup_themetip, I fixed that ;)Haven’t read all of the article or all of the comments here, but I just wanted to say it is great so far, and THANK YOU! Would love to see more of these technical breakdowns / tutorials in the future. Keep up the great work!
Chris, thanks again for the suggested corrections, that was very nice of you and yes, we’ll certainly keep the posts coming! I bet you’ll love our “Internals” series by Gennady ;)
Cheers!
Hi Konstantin. Thanks for that incredible post! I was exactly looking for this conversation. I’m thinking about using Twenty Eleven as a start for developing a personal theme.If for some reason your neat trick doesn’t pass theme-check, you can always grab Otto or Chip to help you through.
Hey, thanks for your comment and good luck the theme!
Hi, Thanks for a great overview…
I’ve been putting off the move to Twenty Eleven for too long. Your article has given me a great basic insight into the differences to Twenty Ten. So I’m taking the plunge today!.. I’m going to use the HTML5 Reset theme as a child theme to really get going with HTML5… another thing I’ve been putting off….
Today it the day :-)
Thanks again for your truly helpful article!!!
:-p
I love Twenty Eleven.
I hate Twenty Eleven.
It just depends on what computer I am using. IPad or Android phone – Fantastic.
Any other screen used by most of the rest of the world? Too much whitespace and scrolling down.
Pingback: Introduction to WordPress Homework – Class 10 – Design, Template Files, Conditional Tags, Class Project | Learning from Lorelle
great post!
we’re working on our website v2, and you guys take us to choose twentyeleven :D
I have been searching the web for instructions on how to add a fourth footer area widget/sidebar to the TwentyEleven theme, like TwentyTen has. Does anyone know how to do this?
Pingback: Introduction to WordPress Homework – Class 12 – Video, Audio, and Podcasts | Learning from Lorelle
Very useful article. This is the best article I found and read about twetyeleven theme.
Thanks Mojtaba glad you found it useful.
I am thinking of switching to Twenty Eleven. My only question is, can I use it with no header photo? If so, will I be left with a large empty white space or will the header-photo-allocated section be hidden?
Thanks alot for the info. I really didn;t knew that we could change the layout of the theme.