Include files in child theme functions file

Child themes reference parent themes by directory name, and in a normal install all your themes live in wp-content/themes/, so I’d say it’s fine to reference those themes by their relative path:

include '../parent-theme/some-file.php';

If that makes you uncomfortable, I observe the following constants in WordPress 3.0.1 with a twentyten child theme called tt-child:

TEMPLATEPATH     /home/adam/public_html/wp3/wp-content/themes/twentyten
STYLESHEETPATH   /home/adam/public_html/wp3/wp-content/themes/tt-child

So you can do the following in your child theme to reference the parent theme directory:

include TEMPLATEPATH . '/some-file.php';

Leave a Comment