描述
没有尾随斜杠。
参数
- $stylesheet_or_template
-
(string)(可选) 主题的样式表或模板名称。默认情况下是利用主主题根。
默认值: ''
返回
(string) 主题目录路径。
源码
更新日志
版本 | 描述 |
---|---|
1.5.0 | 开始引入 |
使用示例
主题目录中的子目录数
下面的函数通知主题目录中子目录的数量。请注意,这不一定与WordPress识别的主题数量匹配。<?php function display_themes_subdirs_count_info() $theme_root = get_theme_root(); $files_array = glob("$theme_root/*", GLOB_ONLYDIR); echo "There are " . count($files_array) . " subdirectories in the " . $theme_root . " directory"; } ?>
示例输出:
There are 5 subdirectories in the /home/user/public_html/wp-content/themes directory.