Languages: English • stylesheet directory 日本語 한국어 • (Add your language)
This functions returns the absolute path of the current theme (the stylesheet directory) that contains your stylesheet(s). If you have a child theme, this returns the absolute path of the child theme.
Note:the returning path does not contain a trailing slash.
An example output of get_stylesheet_directory() is
/home/user/public_html/wp-content/themes/my_theme
To retrieve the URI of the stylesheet directory use get_stylesheet_directory_uri().
To retrieve the path of a parent theme, use get_template_directory().
<?php get_stylesheet_directory() ?>
None.
Include a PHP file
<?php include( get_stylesheet_directory() . '/includes/myfile.php'); ?>
get_stylesheet_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()