get_theme_roots()获取主题themes文件夹名称

目录

描述

Retrieves an array of the names of theme directories keyed by the template/stylesheet or the name of the themes directory if all the themes have the same parent (root) directory. The names are without the trailing but with the leading slash.

get_theme_roots() 描述

用法

 <?php echo get_theme_roots(); ?> 

get_theme_roots() 用法

参数

This tag has no parameters.

get_theme_roots() 参数

返回值

(array/string

An array of the names of theme directories keyed by the template/stylesheet or the name of the themes directory if all themes have the same parent directory. The names are without the trailing but with the leading slash.

get_theme_roots() 返回值

注意

get_theme_roots() 注意

历史

  • 添加于 版本: 2.9.0

get_theme_roots() 历史

源文件

get_theme_roots() 函数的代码位于 wp-includes/theme.php.

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * Retrieve theme roots.
 *
 * @since 2.9.0
 *
 * @global array $wp_theme_directories
 *
 * @return array|string An array of theme roots keyed by template/stylesheet or a single theme root if all themes have the same root.
 */
function get_theme_roots() {
	global $wp_theme_directories;

	if ( count($wp_theme_directories) <= 1="" )="" return="" '/themes';="" $theme_roots="get_site_transient(" 'theme_roots'="" );="" if="" (="" false="==" $theme_roots="" )="" {="" search_theme_directories(="" true="" );="" regenerate="" the="" transient.="" $theme_roots="get_site_transient(" 'theme_roots'="" );="" }="" return="" $theme_roots;="" }="">

get_theme_roots() 源文件