描述:
获取当前主题样式表style.css所在的目录路径
用法:
<?php get_stylesheet_directory() ?>
参数:
None
示例:
<?php include( get_stylesheet_directory() . '/includes/myfile.php'); ?>
源文件:
/** * Retrieve stylesheet directory path for current theme. * * @since 1.5.0 * * @return string Path to current theme directory. */ function get_stylesheet_directory() { $stylesheet = get_stylesheet(); $theme_root = get_theme_root( $stylesheet ); $stylesheet_dir = "$theme_root/$stylesheet"; /** * Filter the stylesheet directory path for current theme. * * @since 1.5.0 * * @param string $stylesheet_dir Absolute path to the current them. * @param string $stylesheet Directory name of the current theme. * @param string $theme_root Absolute path to themes directory. */ return apply_filters( 'stylesheet_directory', $stylesheet_dir, $stylesheet, $theme_root ); }