get_stylesheet_directory()
Retrieve stylesheet directory path for current theme.
Used By: get_theme_file_uri()
1 time — 0.000027 sec (very fast) | 50000 times — 0.28 sec (very fast) | PHP 7.0.2, WP 4.4.1
Hooks from the function
Return
String
. Path to active theme's stylesheet directory.
Usage
get_stylesheet_directory();
Examples
#1 Demo
echo get_stylesheet_directory(); // return: /home/k/kama/example.com/public_html/wp-content/themes/themename
#2 Connect the myfile.php file for current theme:
The example shows how to use the function. Use this code in the parent theme to support the child theme:
require_once get_stylesheet_directory(). '/includes/myfile.php';
Notes
- Global. String. $wp_stylesheet_path Current theme stylesheet directory path.
Changelog
Since 1.5.0 | Introduced. |
Since 6.4.0 | Memoizes filter execution so that it only runs once for the current theme. |