Languages: English • template directory 日本語 (Add your language)
Retrieves the absolute path (eg: /home/user/public_html/wp-content/themes/my_theme) to the directory of the current theme.
If a child theme is being used, the absolute path to the parent theme directory will be returned. Use get_stylesheet_directory() to get the absolute path to the child theme directory.
Note: The output does not include a trailing slash.
To retrieve the URI of the stylesheet directory use get_stylesheet_directory_uri() instead.
<?php echo get_template_directory(); ?>
This tag has no parameters.
Include a PHP file
<?php include( get_template_directory() . '/includes/myfile.php'); ?>
Since: 1.5.0
get_template_directory() is located in wp-includes/theme.php
.
Theme paths: get_template(), get_template_directory(), get_template_directory_uri(), get_theme_roots(), get_theme_root(), get_theme_root_uri(), get_stylesheet(), get_stylesheet_uri(), get_stylesheet_directory(), get_stylesheet_directory_uri(), get_bloginfo(), get_theme_file_uri(), get_theme_file_path()