get_themes

函式
get_themes ( No parameters )
返回值
  • (array) Theme list with theme data.
相關
  • wp_get_themes()
定義位置
相關方法
get_themewp_get_themesget_termsget_theme_modsget_the_time
引入
1.5.0
棄用
3.4.0

get_themes: 這個函式返回一個已安裝主題的關聯陣列,其中鍵是主題的目錄名稱,值是該主題的後設資料陣列,包括主題名稱、版本、作者等等。

檢索主題目錄中帶有主題資料的主題列表。

如果該主題沒有一個父主題,並且缺少style.css和index.php,那麼該主題就是壞的。如果該主題有一個父主題,那麼它就是壞的,如果它缺少style.css;index.php是可選的。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function get_themes() {
_deprecated_function( __FUNCTION__, '3.4.0', '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;
}
function get_themes() { _deprecated_function( __FUNCTION__, '3.4.0', '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; }
function get_themes() {
	_deprecated_function( __FUNCTION__, '3.4.0', '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;
}

常見問題

FAQs
檢視更多 >