The Importance Of Creating A WordPress Child Theme

After installing WordPress and activating a theme you’re happy with, it’s a good idea to set up a child theme. This allows you to customize the styles for the theme you’ve chosen – and more importantly, to keep these styles after the next theme update.

I did not know any of this before I set up the ancient Greek blog, and enthusiastically went to work updating the style sheet for the Twenty Ten theme. Then when it came time to update that theme, I lost all my changes! (There was a backup of a style sheet that had some – but not all – of the style changes that had been made.)

For a few months after that, I always kept a recent copy of my modified style sheet, so that it could be uploaded whenever a theme update was needed. And eventually I got around to setting up a child theme, and placed the modified style sheet into it.

But this really isn’t the best way to do this. In my case, the parent style sheet is about 1,400 lines long, and my child style sheet is 2,000 lines long. And much of the latter code is identical to the parent style sheet, which no doubt slows down load times.

At this stage it would take a bit of work to trim out all that redundant code. So take it from me – set up a child theme right from the start so you can keep your style changes during theme updates, and to keep your installation running as fast as possible.

UPDATE: Looks like my setup isn’t as bad as I thought. Since the child theme style sheet contains all the code from the parent, I didn’t add this line at the beginning of the child’s style sheet:

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

Therefore, the parent style sheet doesn’t get imported at all – only the 2,000 line child theme style sheet is imported.

This entry was posted in WordPress, WordPress - Installation. Bookmark the permalink.