WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get template directory

Description

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.

Usage

<?php echo get_template_directory(); ?>

Parameters

This tag has no parameters.

Return Values

(string) 
Absolute path to the directory of the current theme (without the trailing slash).

Examples

Include a PHP file

<?php include( get_template_directory() . '/includes/myfile.php'); ?>

Notes

Change Log

Since: 1.5.0

Source File

get_template_directory() is located in wp-includes/theme.php.

Related

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

See also index of Function Reference and index of Template Tags.