How to Change Colors in the Twenty Eleven WordPress Theme: A Complete Guide
Content
Customizing the look of your WordPress site is a common task, and one of the most frequent requests is changing colors. For users of the classic Twenty Eleven theme, this can sometimes be confusing. This guide compiles the most effective methods for modifying colors throughout the theme, from the menu bar to the footer.
Why You Need a Child Theme or Custom CSS
Before making any changes, it is crucial to understand that directly editing the Twenty Eleven theme files is strongly discouraged. The 'Twenty Eleven' team, and the wider WordPress community, advise against this because any edits will be overwritten when the theme is updated. This will erase your customizations and could potentially break your site.
The recommended and safest method is to use a child theme. A child theme inherits all the functionality and styling of the parent theme (Twenty Eleven) but allows you to make changes without affecting the original files. If you are only making minor CSS changes, you can also use the built-in Additional CSS option found in the WordPress Customizer (Appearance → Customize → Additional CSS). Many users also find success with custom CSS plugins.
Common Color Customizations and Their Solutions
Based on frequent community questions, here are the CSS selectors and code snippets you need to change specific areas of the Twenty Eleven theme.
1. Changing the Main Navigation Menu Bar Color
The black navigation bar is a signature element of Twenty Eleven. To change its background color, target the #access selector.
#access {
background: #b9cb13; /* Replace with your desired color */
}
2. Changing the Single Post Title Color and Alignment
To change the color and center the title on individual posts, use the .entry-title selector.
.singular .entry-title {
color: #ff0000; /* Red color */
text-align: center;
}
3. Changing Link and Link Hover Colors
To style all links, and their hover states, use the following selectors.
a {
color: #1e73be; /* Normal link color */
}
a:hover {
color: #dd3333; /* Hovered link color */
}
4. Changing the Sidebar Background Color
To add a background color to the main sidebar, target the #secondary selector.
#secondary {
background: #f2f2f2; /* Light gray background */
padding: 15px; /* Adds some space inside the sidebar */
}
5. Changing the Footer Background Colors
The footer in Twenty Eleven has two main sections. The upper widget area and the lower copyright bar.
/* For the upper widget area */
#supplementary {
background: #689C48;
}
/* For the lower copyright bar */
#site-generator {
background: #55bbeb;
}
6. Changing the Comment Form Background Color
The 'Leave a Reply' form has a gray background by default. To change it, use the #respond selector.
#respond {
background: #ffffff; /* White background */
border: 1px solid #d3d3d3;
}
7. Changing the Background on Specific Pages
WordPress automatically adds specific classes to the <body> tag, which you can use to target individual pages or page templates. For example, to change the background on pages using the 'Showcase Template':
/* For the Showcase Template */
.page-template-showcase-php #page {
background: #ffffff;
}
/* For a page with a specific ID (e.g., ID 10) */
.page-id-10 #content {
background: #ffffee;
}
Troubleshooting Tips
- Specificity is Key: If your CSS changes aren't working, the theme's default styles might be overriding them. Make your CSS selector more specific. For example,
body .entry-titleis more specific than just.entry-title. - Use a Web Inspector: Browser tools like Chrome Developer Tools or Firefox Firebug are invaluable. You can right-click on any element on your page, select 'Inspect', and see exactly what CSS is controlling its style. This allows you to test changes in real-time before adding them to your child theme or Customizer.
- Clear Your Cache: After making changes, remember to clear any caching plugins or server-side caches you might be using to see the changes immediately.
By following these methods and using the provided code snippets, you should be able to successfully customize the colors of your Twenty Eleven theme without affecting the core files. Always remember to use a child theme or the Additional CSS section for a future-proof website.
Related Support Threads Support
-
Change single post title color & centerhttps://wordpress.org/support/topic/change-single-post-title-color-center/
-
Change link hover color / no custom color option in Customizerhttps://wordpress.org/support/topic/change-link-hover-color-no-custom-color-option-in-customizer/
-
Showcase Template background colorhttps://wordpress.org/support/topic/showcase-template-background-color/
-
[Theme: Twenty Eleven] Help With Minor Change in Themehttps://wordpress.org/support/topic/theme-twenty-eleven-help-with-minor-change-in-theme/
-
[Theme: Twenty Eleven] How can I change menu bar color?https://wordpress.org/support/topic/theme-twenty-eleven-how-can-i-change-menu-bar-color/
-
Change link colour in posts but not on homepagehttps://wordpress.org/support/topic/change-link-colour-in-posts-but-not-on-homepage/
-
Change Sidebar Background Colorhttps://wordpress.org/support/topic/change-sidebar-background-color-2/
-
Customise H1 title on Twenty Elevenhttps://wordpress.org/support/topic/customise-h1-title-on-twenty-eleven/
-
How to change title colorhttps://wordpress.org/support/topic/how-to-change-title-color-3/
-
[Theme: Twenty Eleven] Need to remove underline from post imagehttps://wordpress.org/support/topic/theme-twenty-eleven-dont-want-background-link-style-on-my-image-in-the-post-only-on-the-text/
-
Zmiana tła lub nagłówkahttps://wordpress.org/support/topic/zmiana-tla-lub-naglowka/
-
[Theme: Twenty Eleven] How to set Dark and White Color Skeme in specific pageshttps://wordpress.org/support/topic/theme-twenty-eleven-how-to-set-dark-and-white-color-skeme-in-specific-pages/
-
Change background color of comment areahttps://wordpress.org/support/topic/change-background-color-of-comment-area/
-
Changing the color in footer and menu alignment/colorhttps://wordpress.org/support/topic/changing-the-color-in-footer-and-menu-alignment-color/
-
[Theme: Twenty Eleven] Can't set blank background on my page white line above footerhttps://wordpress.org/support/topic/theme-twenty-eleven-cant-set-blank-background-on-my-page-white-line-above-footer/
-
[Theme: Twenty Eleven] How do I change the color of the footer widget area?https://wordpress.org/support/topic/theme-twenty-eleven-how-do-i-change-the-color-of-the-footer-widget-area/
-
[Theme: Twenty Eleven] Change border and text color of search widgethttps://wordpress.org/support/topic/theme-twenty-eleven-change-border-and-text-color-of-search-widget/
-
Css for Reply Box in Twenty Elevenhttps://wordpress.org/support/topic/css-for-reply-box-in-twenty-eleven/
-
different bg color in specific pagehttps://wordpress.org/support/topic/different-bg-color-in-specific-page/
-
[Theme: Twenty Eleven] How to change navigation backgroundhttps://wordpress.org/support/topic/theme-twenty-eleven-how-to-change-navigation-background/
-
Changing footer background colorhttps://wordpress.org/support/topic/changing-footer-background-color-2/
-
[Theme: Twenty Eleven] [Theme: TwentyEleven] Transparent background headerhttps://wordpress.org/support/topic/theme-twenty-eleven-theme-twentyeleven-transparent-background-header/
-
How to change colorhttps://wordpress.org/support/topic/how-to-change-color-9/
-
[Theme: Twenty Eleven] Background Color/Image for Bottom Widget Area?https://wordpress.org/support/topic/theme-twenty-eleven-background-colorimage-for-bottom-widget-area/