How to make a child theme for WordPress: A pictorial introduction for beginners

Italian/Italiano

Given their power and how easy they are to use, “child themes” are a surprisingly little-known feature of WordPress. I wish I knew about them the first time I looked for themes. I found then a number of designs I liked but I ended up discarding them all because of a few issues I saw in each; things like small line height, justified text, or a careless selection of fonts.

Now, such issues are easy to fix: With an elementary knowledge of HTML and CSS and a reference at hand, you spot the rules in the stylesheet, change a value or two, and save your changes. But I never liked this option: then, you have to keep track of your changes, remember about them, and reapply them every time the theme is updated. So I settled for a theme that got most of the “details” right but which I did not like that much...

Then I learned about child themes!

If you have found yourself in a similar position, this introduction is for you. It will not teach you how to write CSS — it just explains, with a few examples, how to make a child theme and with it change small things in a WordPress theme you like.

With a bit of reading and experimentation, you can move quickly beyond the basic examples of this introduction and make drastic changes — at a more advanced level, and given a good parent theme, the style and layout of a WordPress site can be changed completely by using only the stylesheet of a child theme, without touching one line of PHP code or HTML markup!

CONTENTS

  1. How child themes work in WordPress
  2. How are themes modified without being modified?
  3. What you need to make a child theme
  4. Assembling a child theme: the framework
  5. Using Firebug
  6. Adding CSS rules to your child theme
  7. Putting it all together and activating the child theme
  8. Notes
  9. Links to tools and resources

1. How child themes work in WordPress

  • You make the child theme: just one directory and one CSS file in it.
    • You may also use a functions.php file (outside the scope of this introduction).
  • The child theme, in its CSS file, declares its parent, i.e., the theme whose templates it uses. It inherits all files of the parent except the stylesheet (which can be explicitly imported). Once everything is in place, the child theme:
    • Is activated like any other theme, via the administration panel.
    • Behaves exactly like its parent, in everything. E.g., if the parent has an options page, the child will have it too.
    • Looks exactly like its parent, plus or minus any changes you make: you can modify everything beyond recognition or just change one tiny, unnoticeable detail.
  • You don’t have to keep track of your modifications or worry about losing them when the parent theme is updated, since you haven’t touched the parent theme. Your changes are in their own file(s) within their own directory in wp-content/themes.

2. How are themes modified without being modified?

For styling, this is possible thanks to the way Cascading Style Sheets work. In this particular case, the stylesheet of the parent is imported (by an explicit instruction) into the stylesheet of the child. Then, you add your own rules to the child’s stylesheet. When a rule you added conflicts with a rule of the parent, here is what happens — quoted from the CSS 2.1 Specification:

[I]f two declarations have the same weight, origin and specificity, the latter specified wins. Declarations in imported style sheets are considered to be before any declarations in the style sheet itself. — SOURCE

Let’s see an example. The parent stylesheet says:

body {
    color: #3f3f3f;
    }

It means gray text (on white background). But you prefer black. So, into the stylesheet of the child you put:

body {
    color: #000000;
    }

The two declarations conflict. They are equal in everything except this: The parent’s comes from an imported stylesheet, while the child’s is in the stylesheet itself. — The child wins!

SYNTAX OF CASCADING STYLE SHEETS

As you can see in the example above, the syntax of CSS is simple and the naming scheme intuitive:

There are rules. Each rule has a selector, for example body or p(aragraph), and a declaration block. The declaration block is enclosed in braces and it can contain several individual declarations, which are separated by semicolons. Each declaration has a property (in the examples above, color) for which a value is specified. That’s it!

3. What you need to make a child theme

NECESSARY

  • FTP access to your site (sites on wordpress.com don’t offer this) and an FTP client.
  • A text/code editor (like the Windows Notepad, but preferably better).
  • A parent theme. In the examples I use Basic2Col: wangenweb.com/wordpress/themes/basic2col — Most likely, you will be able to follow the examples by using any good theme as a parent (you’ll just have to adapt some names in the example stylesheet). You may also want to look at this review: Five clean, minimalist themes for WordPress - op111.net — all 5 themes work well with child themes. (All tested!)

RECOMMENDED

  • Firebug, a Firefox extension.
  • A reference on HTML tags and CSS properties. I use the ones by HTML Dog.
  • A CSS validation service to be sure that your CSS code is valid.

Before continuing, please look at the links at the end. They include recommended tools (for all platforms), resources, and a few good references. I find it essential having a couple of references open in tabs when I play with HTML and CSS.

4. Assembling a child theme: the framework

4.1. Step A

Open your text editor, make a new file, and paste the following into it:

/*
Theme Name: Kid
Theme URI: http://op111.net/
Description: Child Theme for Basic2Col
Author: Demetris
Author URI: http://op111.net/
Template: basic2col
Version: 0.1
.
This work is released under the GNU General Public License 2:
http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
.
*/
 
@import url("../basic2col/style.css");

Adapt the two URIs (Uniform Resource Identifiers) and the Author’s name, and save the file as style.css somewhere convenient.

NOTES

  1. The name of the stylesheet —style.css— is important. The child theme will not be recognized by WordPress unless a file with this exact name is found in its directory.
  2. The part between /* and */ is how WordPress identifies the theme, in order to display it in the administration panel. This part is ignored by browsers, since everything between /* and */ is a comment in CSS syntax.
  3. The Template line is important, since it declares the parent theme. The parent must be declared by the name of its directory exactly as you see it, case-sensitively — not by the name of the theme. Often the two are different.
  4. The @import rule must precede all other rules. That is, any styling rules you add must be placed after it. (If you put rules before it, it will be invalidated, and the parent stylesheet will not be imported.) — What this rule does is giving an instruction to the browser when a page is viewed: “Go to the parent directory [the meaning of the double dot in directory browsing], get into the directory basic2col, get the content of style.css and @import it here.”

4.2. Step B

Make sure that the parent you declared is present in your installation. If it is not, upload it to the themes directory.

In the same directory —wp-content/themes— make a new directory and name it “kid” — or anything you like; “kid” is just the name I use in the examples.

Technically, your child theme is ready. You can upload style.css to the directory “kid” and activate the child theme from the administration panel — but the child theme will look exactly like its parent, since it inherits everything from the parent without adding anything of its own.

Now you can start adding rules to the child’s stylesheet. Finding the rules and values that do what you want can be a pain sometimes, but there is a tool that makes all this a breeze. Let’s have a quick look at this tool:

5. Using Firebug

Install Firebug in Firefox: http://getfirebug.com/ — Now see the next 3 steps on how to use it to inspect CSS information and edit it live.

Right-click on an item on a page and select “Inspect Element”. Here I’m looking for the styling of some fixed-width text:

A panel emerges with all the information you may need. Now you can inspect:

Click on a value to edit it. Once you are satisfied with the result, copy the value and paste it in the stylesheet you are preparing.

Hitting Escape cancels editing, while Enter makes the change stick until the next page refresh. This means that you can inspect and edit items, one after the other, and have the combined result of your changes updated live the whole time.

6. Adding CSS rules to your child theme

The theme I use as a parent in the examples is Basic2Col. I selected it because it is one of the themes made with child themes in mind, and, for this reason, very easy to work with: wangenweb.com/wordpress/themes/basic2col

6.1. Changing the style of links

Suppose you want to change the dark red of hyperlinks in Basic2Col. You prefer green. Right-click on a link to inspect its styling:

Firebug reveals that this dark red is #660000 — that is, in decimal, rgb(102,0,0).

Stylesheets understand both hexadecimal and RGB chromatic notation. In RGB notation you can use either absolute values or percentages. They also understand some colour names. So, white and #ffffff and rgb(255,255,255) and rgb(100%,100%,100%) are all valid and equal in CSS syntax.

Right-click on the value and start typing. In the screenshot I’m starting from the green with the same saturation and brightness, that is, #006600.

Firebug automatically updates the display as the chromatic value is edited.

After trying all kinds of green, you finally settle for the one you started with: #006600. (Hypothetical here but happens all the time!) Add this to your stylesheet:

a:link, a:visited {
    color: #006600;
    }

Now, you don’t know this yet, but, as soon as you activate the child theme, links will stop changing colour on hover. (If you are interested in a detailed why, see links at the end.) To preserve the setting of the parent for hovered and active links, find the rule the parent uses and add it to your stylesheet, after the rule for links and visited links:

a:hover, a:active {
    color: #666666;
    }

6.2. Adding a font

The links are styled to your satisfaction now. Something else you will probably want to experiment with in any theme is fonts. Let’s see what fonts Basic2Col uses. Right-click on some text to inspect:

The first thing you notice is that paragraphs inherit some font styling, including font-family, from the body, for which ten fonts are specified, in order of preference. To try a different font, type its name before any other names, and then a comma. (If the font has spaces in its name, it is good practice to enclose it in quotation marks.) In the screenshot I’m trying a Microsoft ClearType font, one of the so-called “C” fonts:

If you are satisfied with the result you see above, paste this into your stylesheet and you are done with this part:

body {
    font-family: Candara, "Lucida Sans Unicode", "Lucida Sans",
        "Trebuchet MS", "Lucida Grande", "Bitstream Sans Vera",
        Verdana, Arial, Tahoma, Helvetica, Sans-Serif;
    }

6.3. Hiding an element

Now let’s try something different. In the previous two examples we edited values of existing properties, to override declarations imported from the parent stylesheet. In the next example we will add a new declaration to a rule.

The search box in Basic2Col has a title above it: “Search”. This is not necessary. It’s obvious what that box does; it even has a button next to it saying “Search”. Is it possible to make this title go away, and reclaim the space it takes, without meddling with files in the parent theme? — It is!

By inspecting this element you find that the selector you want is:

#searchform label

... which means: label but only if it is within the division uniquely identified as searchform. Click on its declaration, hit Tab to start a new line, type display — then hit Tab again and type none — see the screenshot:

The title of the search box disappeared!

It did, but something is not right now! Without its title, the search box does not look properly aligned. It needs to be moved a bit to the left. This is not difficult to do, but let’s say, for the sake of brevity, that you didn’t notice it and that you are satisfied with the result. Put this in your stylesheet:

#searchform label {
    display: none;
    }

You don’t see anything else you would like to change for the time being. (And if you see something later, you can always open your stylesheet, add or remove anything you like, and upload it again to the directory of your child theme.) Let’s see what we have by now:

7. Putting it all together and activating the child theme

In a few minutes you constructed 4 CSS rules: 2 for links, 1 for fonts, and 1 to hide something from display. If you pasted the result of each step into your stylesheet, it must look like this now:

/*
Theme Name: Kid
Theme URI: http://op111.net/
Description: Child Theme for Basic2Col
Author: Demetris
Author URI: http://op111.net/
Template: basic2col
Version: 0.1
.
This work is released under the GNU General Public License 2:
http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
.
*/
 
@import url("../basic2col/style.css");
 
a:link, a:visited {
    color: #006600;
    }
a:hover, a:active {
    color: #666666;
    }
body {
    font-family: Candara, "Lucida Sans Unicode", "Lucida Sans",
        "Trebuchet MS", "Lucida Grande", "Bitstream Sans Vera",
        Verdana, Arial, Tahoma, Helvetica, Sans-Serif;
    }
#searchform label {
    display: none;
    }

The visual result may be slightly different, depending on your editor. In Notepad++ I’m seeing this:

Now upload the stylesheet to the child theme’s directory and go to the administration panel, Design, Themes, to activate it. (The child theme will not have a thumbnail screenshot. You can add one to its directory if you want, and it will be detected by WordPress, but it is not of much use unless you intend to publish the theme.)

If in preview your theme looks exactly like its parent, empty your browser’s cache and retry.

If everything looks good in preview, you can now activate the theme. Congratulations! Your first child theme is on the air!

8. Notes

You really made it all the way down here? Thanks for reading!

If you know any good resources on this topic in languages other than English, please leave a comment with the link(s). Thanks again!

9. Links

9.1. Parent themes

Almost any good theme can be used as a parent theme, but here are three more that are designed with child themes in mind:

themehybrid.com/themes/hybrid
Hybrid by Justin Tadlock.
themeshaper.com/thematic-for-wordpress
Thematic by Ian Stewart.
www.plaintxt.org/themes/sandbox
Sandbox by Andy Skelton and Scott Wallick. The mother of all parent themes.

9.2. Tools, Software

bluefish.openoffice.nl
Default editors in Linux distributions are more than enough for such tasks. If you want to try something else, Bluefish is good. Look in your distro’s repositories (Debian and Ubuntu have it).
cyberduck.ch
Cyberduck: Good, free, open-source FTP client for Mac OS X.
fireftp.mozdev.org
FireFTP: “a free, secure, cross-platform FTP client for Mozilla Firefox which provides easy and intuitive access to FTP servers”.
getfirebug.com
A Firefox extension to “edit, debug, and monitor CSS, HTML, and JavaScript live in any web page”.
jigsaw.w3.org/css-validator
CSS Validation Service. To validate your CSS code.
notepad-plus.sourceforge.net
Notepad++ is a good, free, open-source text/code editor for Windows.
Notepad2, with the same basis as Notepad++, is simpler but fine for most tasks: www.flos-freeware.ch/notepad2.html
smultron.sourceforge.net
Smultron: good, free, open-source text/code editor for Mac OS X.
www.mozilla.com/firefox
There is no escaping Firefox! — obviously, to use Firebug, you need Firefox.

9.3. Tutorials, References

codex.wordpress.org/Theme_Development
Has a short section on child themes.
extralogical.net/2008/08/theme-inheritance
In WordPress 2.7 you will be able to do more things with a child theme. The creator of the theme Tarski talks about the possibilities opened.
reference.sitepoint.com/css
SitePoint CSS Reference.
themeshaper.com/how-to-protect-your-wordpress-theme-against-upgrades
The author of the theme Thematic explains how to make child themes. — The alliteration is unavoidable!
themeshaper.com/functions-php-wordpress-child-themes
Another article by the author of Thematic: How to use custom PHP functions in your child theme.
wangenweb.com/2008/07/creating-wordpress-child-themes
Another how-to on child themes, this one by the designer of Basic2Col.
www.htmldog.com
“The Best Practice Guide To XHTML and CSS”, by Patrick Griffiths. It really is the best!
www.htmldog.com/reference/cssproperties
CSS properties at HTML Dog: “information about all of the valid properties belonging to the CSS 2.1 standard”.
www.htmldog.com/reference/htmltags
HTML tags at HTML Dog: “information about all of the valid tags belonging to the latest version of strict XHTML”.

9.4. Further reading

meyerweb.com/eric/css/link-specificity.html
Eric Meyer explains why the order in which we add link rules to a stylesheet is important.
www.w3.org/TR/CSS21
The CSS 2.1 specification.

Translations

Italian
Come creare un Child Theme per WordPress, translated by Danny.

Changes

2009-03-29
Replaced Stylegala CSS Rererence link with SitePoint CSS Reference link in 9.3. Several other edits.
2009-02-21
Added link to Italian translation. Thanks, Danny!
2008-12-22
Replaced Structure (Links, Parent themes) with Hybrid, the latest theme by J. Tadlock.
2008-09-01
Added links for parent themes, spell-checked, several other edits.

Similar & Related

46 Comments

  1. Posted 2 Sep 2008 at 08:17 | Permalink

    I just started playing with child themes and something very funny is happening to me…

    After I activate the child theme, the WP headers at the style file (the comments defining the theme info) are disappearing.

    Has anyone seen something similar?

  2. Posted 2 Sep 2008 at 12:20 | Permalink

    @Moises: That’s strange. The only way to change the contents of style.css is to open it in an editor. What are you seeing if you open the stylesheet in your browser?

    For comparison, here is the child stylesheet of op111.net: http://op111.net/wp-content/themes/dk/style.css

  3. Posted 5 Sep 2008 at 09:20 | Permalink

    I’ve been recommending this to almost everyone who asks a customization question about Simplish — since we update the theme pretty often it’s about the only way to keep up.

    Nice work, thanks for the resource.

  4. Posted 5 Sep 2008 at 13:47 | Permalink

    Well done Demetris this is very helpful.
    Thanks a lot!
    Marc

  5. Posted 6 Sep 2008 at 01:34 | Permalink

    Great, clear and very clever tutorial. Thanks a lot for all the effort you put in it. I blog with Wordpress and make little changes in some themes, but this is a very big (next) step to me.

    Greetings from Spain and thanks again

  6. brandon
    Posted 6 Sep 2008 at 01:58 | Permalink

    This is great to know. It doesn’t help me theme though, because I need to make changes to more files than style.css when I hack from an existing theme. Layout changes, etc. Is there a way to do that with child themes?

  7. Posted 6 Sep 2008 at 08:33 | Permalink

    This technique is getting more and more popular. Thanks for the tutorial. You have been bookmarked. :)

  8. Posted 9 Sep 2008 at 07:08 | Permalink

    Thanks, this was very helpful. I think I’m finally getting my head around it all!

  9. Posted 18 Sep 2008 at 17:01 | Permalink

    Great tutorial.

    I used this method while designing a new theme before I ever saw this tutorial. To me this method just makes sense. It is a simple way to keep a “custom” stylesheet that will always override your imported stylesheets. As you said, this makes upgrading a breeze as well.

  10. laras
    Posted 8 Nov 2008 at 14:06 | Permalink

    what step to make thames in hand phone?

  11. Posted 17 Nov 2008 at 08:15 | Permalink

    Thank you for this wonderful tutorial. It shed some light on the subject and finally made me understand how to make a child theme. I am currently working on my first one and not having many problems thanks to you!

  12. Posted 26 Nov 2008 at 09:13 | Permalink

    A very nice an indepth tutorial. Thank you very much

    regards
    Thinkjayant

  13. Posted 10 Dec 2008 at 08:50 | Permalink

    Great tutorial, I love how much detail you put into each step. Keep up the great work.

  14. Posted 3 Jan 2009 at 13:56 | Permalink

    You have done a great job with this tutorial. Thanks for the step by step, well written guide. I like your layman’s approach to teaching. I hope you continue upgrading and adding to the tutorial.

  15. Posted 19 Jan 2009 at 02:40 | Permalink

    Thanks, Bill! I’m planning on adding to the tutorial, possibly with a Part 2. Stay tuned! :-)

  16. Posted 6 Feb 2009 at 12:43 | Permalink

    I’ve tried to use this technique to introduce a “grandchild” theme. I am currently running “Old School” which is a child theme of the “Hybrid” Template. I don’t like Old School’s styling but I love it’s functionality. But WP is telling me that I haven’t defined a template and therefore won’t recognize my stylesheet. I’ve rechecked names. Is this functionality limited to first-generation themeing?

  17. Posted 6 Feb 2009 at 13:33 | Permalink

    @Chiinook:

    I think so. Because WP won’t recognize as a valid parent a theme without index.php.

    Here is what I’d do in this case:

    1. Make a CSS file with the rules you want to use to override the Old School rules you don’t like.

    2. Put this somewhere in your site. E.g.: http://example.net/wp-content/themes/chiinook.css

    3. Use a plugin that can modify the HTML head, to link to your stylesheet.

    At every page load your CSS will be loaded AFTER the parent and grandparent stylesheets, overriding any rules that come from them and conflict with its own rules.

    A very good plugin to use for this (linking to a stylesheet from the head element of HTML pages) is HeadSpace2. It has a module especially for this, called “Stylesheets”, and you can even use this module per page or per post.

    http://urbangiraffe.com/plugins/headspace2/

    If you try this approach, let me know how it went.

  18. Posted 14 Feb 2009 at 16:42 | Permalink

    And another thank you. Great explanation. Just beginning to make changes, but the method makes sense now.

  19. Chris Reid
    Posted 21 Feb 2009 at 00:12 | Permalink

    Fantastic guide, I can’t wait to start playing around with a Thematic-based child theme. One small problem: I get a “template is missing” message from the wordpress admin panel when I try and activate my child theme. I copied the comment code exactly and all my directories appear to be in the right place. Does the directory for the child theme need anything other than a “styles.css” with the requisite code (and of course whatever changes I add)?

  20. Posted 22 Feb 2009 at 10:00 | Permalink

    @Chris Reid:

    Chris, it might be the Template line. This must be the name of the template’s directory and it is case-sensitive. E.g., if you type Thematic instead of thematic, it won’t work and you’ll get the message “Template is missing” for your child theme.

    If it’s not that, can you paste the header of your style.css here?

  21. Chris Reid
    Posted 23 Feb 2009 at 16:24 | Permalink

    Thanks so much for taking the time to help. I triple checked the directories. Both thematic and my child theme (”iplj”) are in their own folders in the “themes” directory of my WP install. My child theme has just the “style.css” file in it and my thematic install is unmodified from whatever I downloaded from the official site. The thematic folder is titled “thematic” (definitely lower case “t”).
    Interestingly, WP seems to be picking up the “Theme Name:” field from my styles.css file, since the”Manage Themes” control panel displays the right name for my child theme even though it lists it under “broken themes: and says that the “Template is missing”. Anyway, what follows is the exact header of my style sheet (and again, thanks so much for your help):

    
    /*
    Theme Name: IPLJ Blog
    Theme URI: http://iplj.net/blog
    Description:
    Version: 0.1
    Author: Chris Reid
    Author URI:
    Tags: 2 column
    Template: thematic
    .
    License: GNU GPL
    .
    */
    

  22. Posted 23 Feb 2009 at 17:07 | Permalink

    Mystery solved! :-)

    It seems the file was edited in some rich-text editor—like WordPad—and was formatted in RTF (rich text format).

    See how it appears to a program that expects plain text:

    http://iplj.net/blog/wp-content/themes/iplj/style.css — UPDATE: Fixed now.

    Just use a PLAIN text editor that does not apply any formatting, like Notepad, or any of the others mentioned in the Links section.

  23. Chris Reid
    Posted 23 Feb 2009 at 20:54 | Permalink

    Of course! How silly of me (although I shouldn’t be surprised that Mac OS’s basic text editor defaults to rtf instead of plaintext). I saved as plaintext and it works perfectly now. Thank you so much for your help (and really prompt responses). Now time to get down to some coding.

  24. Posted 25 Feb 2009 at 09:32 | Permalink

    @ Chris Reid: You are welcome, Chris. I’m glad we were able to solve this!

  25. aoda
    Posted 25 Mar 2009 at 19:42 | Permalink

    This is awesome. I finally get it, thanks to this step-by-step guide!

  26. Posted 29 Mar 2009 at 06:18 | Permalink

    Wow!!! I can’t even begin to tell you how helpful this tutorial was. I am brand new on the blogging scene and still have so much to learn. This tutorial not only gave me the ability to “protect” the current theme I am using for my personal blog. But, also gave me a playground, so to speak, to begin learning CSS and start to understand the “guts” of a style sheet. I haven’t worked my way through this entire tutorial, I got seriously distracted once I installed firebug…what a powerful and helpful tool! Thanks so much for letting us know about it.

    I’m so excited, I want to share with you what I’ve been able to learn, simply because of the inspiration of this post. I, too, installed Basic2Col for my parent theme. Once I followed your instructions to make a child theme and started playing with firebug, this is what I was able to come up with! http://sandbox.frogforpeace.com/

    Thanks again so much for providing such a simple and accurate tutorial on making a child theme. Great stuffage!

  27. Posted 29 Mar 2009 at 11:41 | Permalink

    Thanks, aoda and Mags, for the appreciation.

    @ Mags: Your frogs are delightful. And I agree about Firebug: it can be a serious distraction. :-D

  28. Alexa
    Posted 1 Apr 2009 at 22:29 | Permalink

    Hi – Thanks for this – it’s really helpful, but unfortunately, I’ve already put a theme live and made modifications to it already. Could you tell me how to basically take all I’ve got now and make that the child theme, and maybe then I can reload the original theme which I have in the original files? Thanks for your help –
    Alexa

  29. Posted 3 Apr 2009 at 10:16 | Permalink

    @ Alexa: Alexa, I cannot think of an automatic way of doing this. Maybe you could use a diff/merge/comparison program (like WinMerge, Meld or KDiff3) to compare the original file with the modified file, see what your additions are and save them in a new file.

  30. Alexa
    Posted 3 Apr 2009 at 16:34 | Permalink

    Thanks for the reply. Can I not somehow just use my current files as the base for the child theme (copy or rename or something)? Then, reupload the entire theme to be the parent, back as the original? I’m just not sure if I need to start from scratch on the child when I already have what I want. Sorry – my first time at creating a child theme… thanks for any add’l help.

  31. Posted 3 Apr 2009 at 16:51 | Permalink

    You can do that too but it’s not the best solution:

    Ideally, the child stylesheet should contain only rules you want to modify. If you include everything from the parent in the child stylesheet, even rules you don’t want to modify, then some of these rules might change (fixed/improved/etc.) in a future update of your parent theme, and then you will be stuck with the old rules, which will be in the child stylesheet overriding the changed/improved parent rules.

    What I suggested will take more time now but it’s better for future maintenance.

    Does this make sense? :-)

  32. Alexa
    Posted 3 Apr 2009 at 19:41 | Permalink

    Hi there –

    I gotcha. OK, I downloaded a trial of the Merge program from DeltaWalker (there is another one that’s a staff pic for Macs on Downloads but it’s out of my price range) – I’ll compare the code and pull out the differences. That should at least save me time and I don’t think I made that many outside the styles.css – just a handful in home.css, the carousel.css for my theme and then just a few minor on the php file.

    I appreciate the help – if only I had read FIRST! Well, now I know! :0)

    Alexa

  33. Missy
    Posted 5 Apr 2009 at 08:07 | Permalink

    Hi there. this is fantastic for the beginner! Thanks for doing this. I’m using the Thematic template for my blog and I want to change the link/hover/visited colors for the content body but when I change those, it ends up changing the colors for the entry titles as well. I can’t figure out for the life of me, how to select different color combos for the entry title and the content body. Could you share some insight? Thanks.

  34. Posted 5 Apr 2009 at 12:14 | Permalink

    @ Missy: You can make a rule for all links and then make a specific rule for links in titles:

    .entry-title a:link, .entry-title a:visited {
        blah blah blah blah;
    }
    
    .entry-title a:hover, .entry-title a:active {
        blah blah blah blah;
    }

    Or, if you want to change only links within the article (post/page) content, you can just make a specific rule for that case:

    div.entry-content a:link, div.entry-content a:visited {
        blah blah blah blah;
    }
    
    div.entry-content a:hover, div.entry-content a:active {
        blah blah blah blah;
    }

    Does this work for you?

  35. Posted 6 Apr 2009 at 00:11 | Permalink

    Thank you really much. It really helped! At least i finally understood what was going on!

    (Φοβερός φίλε!)

    With respect,
    aflets

  36. Missy
    Posted 6 Apr 2009 at 20:14 | Permalink

    oooh. that definitely worked! thanks very much. i was missing the div. part.

  37. Alexa
    Posted 10 Apr 2009 at 01:15 | Permalink

    Hello again! I’m back for just a tiny clarification. Thanks to you – I was able to successfully create a child theme (I used DeltaWalker’s Merge software – worked fantastically) – so that’s great. But, I’m unclear what other “child” theme pages I can have. I’ve also made changes in this theme to:
    - home.css
    - nav.css
    - carousel.css (it has a carousel that auto pulls images and posts)

    and just a few in index.php about comment behaviors.

    Can you tell me if I just make copies of these like I did with the style.css for the CSS files? Or what about the index? Just trying to get back to my original designs. Thanks!

    Alexa

  38. Michael
    Posted 13 Apr 2009 at 19:24 | Permalink

    Best explanation of the way child and parent themes interact that I have come across in four hours of clicking around the web.

    I read it and said ‘of course’ as I slapped myself on the forehead. But I hadn’t had an ‘of course’ moment until now …

  39. Posted 11 May 2009 at 07:44 | Permalink

    yeah, i think child theme is a great approach if you don’t want to create just a minor version of your theme. but is it make your theme load time longger cause you have to create two styleshette and make more http request to the server ?

  40. Posted 6 Jun 2009 at 21:55 | Permalink

    Hi. Per Demetris, Feb 23 post, I am having the same problem. WP is saying that I have stylesheet and theme missing. I corrected the case, made it all lower case but that still didn’t work. Here is what I have:

    /*
    Theme Name: Thematicoo
    Description: Child Theme for Thematic
    Template: thematic
    */

    I created the directory and everything. It recognizes my thematicoo name but nothing else. And i created it in notepad. Please help!!!

  41. Posted 6 Jun 2009 at 22:12 | Permalink

    @Marlita: What happens if you type the CSS URL in your browser. Do you see the file?

    The CSS URL should be something like: http://example.net/wp-content/themes/thematicoo/style.css

    @uwiuw: That’s right. But I think that one HTTP request is a small price to pay for the convenience and flexibility of a child theme. You can avoid the extra HTTP request by copying all rules of the parent stylesheet into the child stylesheet, and then adding your own rules. But then you lose some of the convenience and flexibility.

  42. Posted 6 Jun 2009 at 23:07 | Permalink

    Demetris, yes, I am able to see it in my browser. Now what do I do? Why won’t WP recognize it?

  43. Posted 6 Jun 2009 at 23:39 | Permalink

    I just made a child theme for Thematic exactly like the one you have:

    http://op111.net/wp-content/themes/thematicoo/style.css

    … and it works fine. Try saving that and dropping it in you Thematicoo directory, to see if it makes any difference.

  44. Posted 7 Jun 2009 at 00:03 | Permalink

    Demetris, I think I’m retarded. I tried it and it is still telling me that it is incomplete.
    Could it be my directory structure:
    …net/blog/wordpress/wp-content/themes/thematicoo/styles.css?

    I see yours was shorter. I copied exactly what you typed. I set up my blog in a folder because I already have a site that I want to leave that up while I fix this one

  45. Posted 7 Jun 2009 at 15:34 | Permalink

    @Marlita: I tried the exact same structure (/blog/wordpress/etc.) on a test installation, and it worked for me. So, in theory, yours should work too.

    Either we are missing something obvious or, perhaps, it is something to do with the version of WP used? (I’m using the latest beta of 2.8.) I’m afraid I can’t be of more help without access to the site and files.

  46. Posted 24 Jun 2009 at 23:21 | Permalink

    Great information all in one place. Thank you for taking your time to put it together. Parent/Child theme structures are becoming things of import for my next theme idea(s).

29 Trackbacks

  1. [...] been playing with the layout of the blog tonight. The Wordpress child themes actually work really well. Sort of inheritance for theme templates. Anyway, if anyone sees anything [...]

  2. [...] a more comprehensive tutorial on how to create a child theme try this article over at [...]

  3. [...] How to make a “child theme” for WordPress. A pictorial introduction for beginners – op11… – [...]

  4. [...] that’s where you need to read How to make a “child theme” for WordPress. A pictorial introduction for beginners (I like the simplicity of that blog’s permalinks… no obsession over [...]

  5. [...] final încă o recomandare: How to make a “child theme” for WordPress. A pictorial introduction for beginners. Ar fi cam greu să spun că e un material pentru începători, deşi ar putea încerca şi ei. [...]

  6. [...] Read it over at Op111.net [...]

  7. [...] you think to yourself, “how to apply this permanently? That tutorial at op111.net is great, but making a child theme for three tiny rules seems a bit too much. There must be another [...]

  8. [...] Subthemes (a.k.a. child themes) are added using the little discussed “Template:” setting in style.css. Special thanks to Op111.net [...]

  9. [...] Thord Daniel Hedengren ( who redesigned blogherald.com recently ) has announced that he will be using this feature on his upcoming “Notes Blog WordPress theme” If you need more information about how Child themes work, read this extremely helpful article. [...]

  10. [...] Demetris has written one awesome article on how to make a child theme in WordPress. This is one article which gives you a pictorial introduction, so if you are a beginner then you’ll find it extremely handy and can act as a good guide for you. Tags: child themes, Themes, WordPress [...]

  11. [...] How to make a child theme for WordPress [...]

  12. [...] How to make a “child theme” for WordPress. A pictorial introduction for beginners [...]

  13. [...] by Ian Stewart on ThemeShaper and a very good, for such a beginner like me, tutorial on op111.net. Those instructions introduced me to the basics of CSS code and (really very basic) programming in [...]

  14. [...] How to make a “child theme“ for WordPress. A pictorial introduction for beginners [...]

  15. [...] to Wordpress’ child theme functionality, the reskin was a matter of mere minutes, in fact the long part was the graphic work [...]

  16. [...] has put to together a pictorial for beginners using child [...]

  17. [...] بود، می‌دونم. این پایینی‌ها رو بخونید بهتره: How to make a “child theme” for WordPress. A pictorial introduction for beginners Creating WordPress Child [...]

  18. [...] How to make a “child theme” for WordPress This is the only guide you’ll ever need. It also has links to loads of other references that I need not rehash here. [...]

  19. [...] How to Make a “Child Theme” for WordPress [...]

  20. [...] next, learn more about WP child themes. After that, kick one out. (Aggressive, I know.) This entry was posted in Web and tagged child [...]

  21. Theme Thoughts on 10 Jan 2009

    [...] How to Make a Child Theme [...]

  22. [...] “How to make a ‘child theme’ for WordPress” [...]

  23. [...] and among the first to propose a magazine-style layout. The 3.0 version allows users to implement child themes, has integrated support for WordPress 2.7 (paginated and threaded comments, stiky posts) and lots [...]

  24. [...] How to make a “child theme” for WordPress (for beginners) [...]

  25. [...] βάση/γονέα για τροποποιήσεις και επεκτάσεις μέσω ενός «child theme», δηλ. υποθέματος ή υιικού/θυγατρικού θέματος. Επίσης, γίνεται να χρησιμοποιηθεί όπως είναι, όπως [...]

  26. [...] How to make a “child theme” for WordPress. A pictorial introduction for beginners – op11… – The best instructions for creating a child theme for WordPress that I’ve found. [...]

  27. [...] How to make a “child theme” for WordPress. A pictorial introduction for beginners – op111.net [...]

  28. [...] [...]

  29. [...] How to make a child theme for WordPress: A pictorial introduction for beginners – op111.net. [...]

Post a Comment

Your email is never shared. Required fields are marked *

*
*

Subscribe without commenting