preload
0 Comments | Apr 07, 2011

WordPress – Child Themes

Estimated Time To Read This: 2 – 4 minutes      


There have been a couple of posts in this blog series already that have made mention of WordPress themes and custom theme development, so I want to spend some time covering a hot topic today — Child Themes.  Child themes are in short, WordPress’ way of allowing the site’s developer to be able to modify a theme without directly touching any of theme’s core files.  This functionality is important for a couple of reasons:

  • Since WordPress 3.0, site administrators are able to update their wordpress themes from the dashboard, so upgrading a theme should (in theory) no longer break your custom theme by overwriting your changes.
  • Making modifications to a theme that has the core functionality that you’d like already is much quicker than it is to create a brand new theme from scratch… so this can save on development time/money.

Creating a child theme is extremely simple too.  All you really need to do in order to start up a new child theme is to

  1. Create a new subfolder within your wp-content\themes\ directory
  2. Create a file within the subfolder called “style.css”
  3. Create a comment block at the top of your style.css file that is similar to the code block below:
style.css   
/*
Theme Name: BornInTwentyEleven
Theme URI: http://www.coresolutions.ca/
Description: Child Theme for TwentyTen --> Custom made for clientX
Author: Matthew Leering
Version: 1.0
License: GNU General Public License
License URI: license.txt
Tags: blue, white, fixed-width, threaded-comments, sticky-post, custom-menu
Template: TwentyTen
Version: 0.1
*/

The most important things to take note of in this comment block are

  • Theme Name –> this is the name of your Theme as it is will be displayed within your theme browser in the WordPress backend
  • Description –> this will describe your theme, and this text will also be displayed within your theme browser in the WordPress backend
  • Tags –> if you plan on submitting your theme for public use, then these tags can be searched on when a site administrator is looking for an applicable theme
  • Template –> This is what tells WordPress what the parent theme is… whatever you type in here must match an existing theme directory name verbatim

If you have completed the steps outlined above, you should be able to go into your WordPress backend, and activate your theme under Appearance/Themes.  Then, if all went successfully, WordPress will look for any files first within your child theme, and if the file it’s looking for is not found, it will turn to its parent theme for the files.  There are of course, further ways to get the two themes working together in harmony, but this covers the basics for now.  Feel free to ask if you have any questions about this process!


Tags:, ,





Related Articles


Leave a Reply

* Required
** Your Email is never shared