The problem I am having is that the get_template_directory_uri is pointing to the parent theme like site/wp-content/themes/twentythirteen/myGallery/gallery_functions_include.php

but I want it to point to my child theme which should be site/wp-content/themes/child-twentythirteen/myGallery/gallery_functions_include.php

what I am using is include (TEMPLATEPATH . '/myGallery/gallery_functions_include.php');

3 Answers 3


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 get_stylesheet_directory_uri().

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. http://example.com/wp-content/themes/yourtheme.

  • what about include (TEMPLATEPATH . '/myGallery/gallery_functions_include.php'); this one also goes to the parent directory Commented Jun 18, 2016 at 4:24
  • @ElroyFernandes I've added this to my answer. STYLESHEETPATH is the constant you'd want instead
    – Tim Malone
    Commented Jun 18, 2016 at 4:31
  • 3
    Thanks for answering the question instead of just saying RTM. This popped up first in my search results.
    – rinogo
    Commented May 4, 2017 at 18:46
  • 2
    Good answer but bad naming on WordPress's part - it's not just for stylesheets, it's for JS, assets, includes etc. Commented Sep 21, 2018 at 16:29
  • 1
    @PaulFeakins Don’t get started on naming inconsistencies in WordPress - that’s a long and windy road that leads who-knows-where! ;)
    – Tim Malone
    Commented Sep 21, 2018 at 21:55

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
Your child theme lives here

Your custom styles and templates and all your includes (things like custom javascript, images that are not saved to WP, custom fonts, json data files, and any plugins that you might enqueue) should be moved to child folder OUTSIDE of theme.

\themes\some_theme-child\ (all your custom php template files here)

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.



include (TEMPLATEPATH . '/path-to/my-file.php');


include dirname( __FILE__ ) . '/path-to/my-file.php';

this should work for most common issues

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.