How to Make a WordPress Child Theme with Twenty Ten

The new wordpress 3.0 theme Twenty Ten is now the default theme on all new wordpress blogs. If you want to customize the theme templates or CSS you should use a wordpress child theme instead of directly editing and hacking in your changes. This will ensure that your changes are kept even when wordpress is updated.

To make a child theme, simply make a new directory in the wp-content/themes directory, you can call it whatever you wish.

A child theme only requires a style.css file; create this file and put this code inside:

/*
Theme Name: Your Theme Name
Description: Child theme for the Twenty Ten theme
Author: Your Name
Template: twentyten
*/

@import url("../twentyten/style.css");

You must have the @import rule before any custom css or it will not work correctly. You can now customize or add any CSS rule.

If you want to modify Twenty Ten’s templates, simply make a copy of a template and paste it in your new child theme directory. WordPress will now use this new template file instead of the default template.

You can also create a custom functions.php file in the child theme directory. Unlike the CSS or template files, it will not overwrite the parent functions.php, it will be included in addition to it.

Using these simple steps I was able to change a few simple CSS rules and add blue to the Twenty Ten blog theme.

/*
Theme Name: Keleko
Description: Child theme for the Twenty Ten theme
Author: Greg Freeman
Template: twentyten
*/

@import url("../twentyten/style.css");

#branding img {
	border-top-color: #1b80c3;
}

#access {
	background: #003f69;
}

#access li:hover > a {
	background: #0b5e96;
}

You can also use these methods to make substantial changes changes to the Twenty Ten theme. Use Twenty Ten’s style.css file or the FireBug FireFox extension as a reference to find out what CSS rules you can modify.

Don’t forget to activate your new wordpress theme in the admin control panel.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

About Greg Freeman

Read more about me on the About Greg Freeman page or twitter.
This entry was posted in Web and tagged . Bookmark the permalink.

4 Responses to How to Make a WordPress Child Theme with Twenty Ten

  1. Gouri says:

    The concept of child theme looks very helpful. Will try it out..

  2. giovanni says:

    this was great! thanks a lot
    gio

  3. Ole Faass says:

    Hy Greg,

    Your adaptations to the twentyten theme look usefull and i tried the child theme on my website. However i could not get it to work on the category view. So if i choose a category i don’t see thubnails, on the mainpage your solution works fine.

    Do you have a solution for the category view as welll. I know it’s in the loop.php somewhere.

    Thanks!
    Ole

  4. Pingback: 如何创建Twenty Ten子主题

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>