Wordpress - 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';
In a child theme the proper way is
require_once( get_stylesheet_directory() . '/foo.php');
While in the parent theme you can still use
require_once ( get_template_directory() . '/foo.php' );
get_template_directory()
still works in the child theme, sadly target the parent theme directory. In your case it's useful
You definitely do not want to hard code the URL. The proper way of doing so is
require_once( get_stylesheet_directory(). '/my_included_file.php' );
See more info at Wordpress Codex
Now, if your e.g. modifying header.php which has an include you would reference it as follows:
require_once( get_stylesheet_directory() . '/../parenthteme/my_included_file.php' );