1. 首页
  2. WordPress 函数手册

get_themes()

get_themes()

检索主题目录中包含主题数据的主题列表。
Retrieve list of themes with theme data in theme directory.

目录锚点:#说明#返回#源码


说明(Description)

另见函数 wp_get_themes()


返回(Return)

(array)包含主题数据的主题列表。


源码(Source)

/**
 * Retrieve list of themes with theme data in theme directory.
 *
 * The theme is broken, if it doesn't have a parent theme and is missing either
 * style.css and, or index.php. If the theme has a parent theme then it is
 * broken, if it is missing style.css; index.php is optional.
 *
 * @since 1.5.0
 * @deprecated 3.4.0
 * @deprecated Use wp_get_themes()
 * @see wp_get_themes()
 *
 * @return array Theme list with theme data.
 */
function get_themes() {
	_deprecated_function( __FUNCTION__, '3.4', 'wp_get_themes()' );

	global $wp_themes;
	if ( isset( $wp_themes ) )
		return $wp_themes;

	$themes = wp_get_themes();
	$wp_themes = array();

	foreach ( $themes as $theme ) {
		$name = $theme->get('Name');
		if ( isset( $wp_themes[ $name ] ) )
			$wp_themes[ $name . '/' . $theme->get_stylesheet() ] = $theme;
		else
			$wp_themes[ $name ] = $theme;
	}

	return $wp_themes;
}
更新版本 源码位置 使用 被使用
3.4.0 wp-includes/deprecated.php:2888 1 function 2

get_themes() 为WP2原创文章,链接:https://www.wp2.cn/functions/get_themes/

发表评论

您的电子邮箱地址不会被公开。