Codex Child Theme Page

A project of even moderate size easily builds up quite a few items in it’s functions.php file. Even when working on a child theme I find that it’s not uncommon to need to add a custom admin panel or a custom post type. There is another gotcha in child themes though.

Typical code samples that talk about organizing files for WordPress will show you something like this.

require_once( TEMPLATEPATH . '/path/to/file.php' );

That works perfectly fine for a regular WordPress them but in a child them it’s pointing at the parent theme. To fix/get around this all you need it a simple modification of which constant you use to:

require_once( STYLESHEETPATH . '/path/to/file.php' );

This is not the first time I’ve written about an include gotcha with Child Themes in WordPress so go read the other article if this isn’t quite what you’re looking for.