get_template_directory_uri pointing to parent theme not child theme
The problem I am having is that the get_template_directory_uri is pointing to the parent theme like
but I want it to point to my child theme which should be
what I am using is
include (TEMPLATEPATH . '/myGallery/gallery_functions_include.php');
You should move your custom templates, those that are not controlled by the active theme, to a child folder.
Keep the theme separate from all customized files this way the theme can be updated without losing your custom work.
Your out-of-the-box theme lives here ------------------------------------ \\Site\wp-content\themes\some_theme
Your child theme lives here --------------------------- \\Site\wp-content\themes\some_theme-child
\themes\some_theme \themes\some_theme-child\ (all your custom php template files here) \themes\some_theme-child\images \themes\some_theme-child\includes \themes\some_theme-child\languages \themes\some_theme-child\json \themes\some_theme-child\style
For your custom style pages (not the theme's overridden style.css) enqueue with wp_enqueue_style( 'some-css', get_stylesheet_directory() . '/style/some.css' , false, '0.0.1', 'all');
Use get_stylesheet_directory_uri() with your xhr calls, etc.
get_template_directory_uri() will always return the URI of the current parent theme.
To get the child theme URI instead, you need to use
You can find these in the documentation, along with a list of other useful functions for getting various theme directory locations.
If you prefer to use a constant, then
TEMPLATEPATH is akin to calling
get_template_directory() (i.e. the parent theme), and
STYLESHEETPATH is akin to calling
get_stylesheet_directory() (i.e. the child theme).
These constants are set by WordPress core in
wp-includes/default-constants.php and basically look like this:
define('TEMPLATEPATH', get_template_directory()); ... define('STYLESHEETPATH', get_stylesheet_directory());
If there is no child theme, then both the 'template' and 'stylesheet' functions will return the parent theme location.
Note the difference between these functions and the functions ending in
_uri - these will return the absolute server path (eg.
/home/example/public_html/wp-content/yourtheme), whereas the
_uri functions will return the public address (aka URL) - eg.
include (TEMPLATEPATH . '/path-to/my-file.php');
include dirname( __FILE__ ) . '/path-to/my-file.php';
this should work for most common issues