WordPress at a glance

get_template_directory() WP 1.0

Retrieve current theme directory.

Возвращает

String. Path to current theme's template directory.

1 time = 0.000028s = very fast | 50000 times = 0.17s = very fast | PHP 7.1.1, WP 4.7.2
Hooks from the function

Usage

get_template_directory();

Список изменений

С версии 1.5.0 Введена.

Code of get_template_directory() WP 5.5.1

wp-includes/theme.php
<?php
function get_template_directory() {
	$template     = get_template();
	$theme_root   = get_theme_root( $template );
	$template_dir = "$theme_root/$template";

	/**
	 * Filters the current theme directory path.
	 *
	 * @since 1.5.0
	 *
	 * @param string $template_dir The path of the current theme directory.
	 * @param string $template     Directory name of the current theme.
	 * @param string $theme_root   Absolute path to the themes directory.
	 */
	return apply_filters( 'template_directory', $template_dir, $template, $theme_root );
}

Related Functions

From tag: theme path (theme folder url)

More from category: Theme files connection

No comments
    Log In . Register