[pthumb][/pthumb]Many Web Developer had been using Child Theme from an existing WordPress Framework to save time and avoid extra ‘grunt’ work from developing a new WordPress Theme for their clients or personal use. There are tons of Free WordPress Framework available on the internet. Here are some of the popular and free to use one:
If you’re a serious and dedicated web developer, then there’s a premium or paid version of WordPress Framework such as Genesis and Thesis.
What is WordPress child theme?
A WordPress child theme is a theme that inherits the functionality of another theme, called the parent theme, and allows you to modify, or add to, the functionality of that parent theme.
Here i will point out couple of extra step you can take to make sure your WordPress Theme is ready to use in child theme development.
1. Add child style.css for your theme
Make sure you include a child-folder inside your WordPress Theme so its easy for other users to create a child theme from your WordPress Theme. its easy, just create a new folder in your theme named child-YOUR-THEME-NAME and add a new style.css inside along with empty screenshots. Content inside child theme style.css should be similiar like this:
Theme Name: Theme Name Child
Theme URI: http://www.link-to-parent-theme.com
Description: Child Theme for Parent Theme Name
Author: Your Name
Author URI: http://www.yoursite.com
License: GNU General Public License
License URI: http://www.opensource.org/licenses/gpl-license.php
2. Proper Action Hooks in Template
This is important for users to add an action hook to your Parent WordPress Theme. Basically its to make the process of editing template layout more convenient and avoid users edits the parent template. You should add do_action() hook to your templates:
[php]<?php do_action(‘wp_before_content’); ?>
<div class=’content’> some code here </div>
<?php do_action(‘wp_after_content’); ?>[/php]
well, you get the point.
3. template_directory() vs stylesheet_directory()
To make sure any template in parent theme are editable via child theme, you should add condition to your include() file like this:
if( is_child_theme() && ‘YOUR-PARENT-THEME-NAME’ == get_template() && file_exists( get_stylesheet_directory() . ‘/custom-functions.php’ ) ):
include( get_stylesheet_directory() . ‘/custom-functions.php’ );
include( get_template_directory() . ‘/custom-functions.php’ );
Its not necessary to take this extra step to prepared your WordPress Theme for child theme. Framework like Genesis or Thesis use a good example of apply_filter() for their theme templating which is much easier if you know how to use add_filter() WordPress core function. Hopefully, this guide will help you understand more about preparing your theme for child theme usage.