get_theme

函式
get_theme ( $theme )
引數
  • (string) $theme Theme name.
    Required:
返回值
  • (array|null) Null, if theme name does not exist. Theme data, if exists.
相關
  • wp_get_theme()
定義位置
相關方法
get_themesget_the_timewp_get_themeget_termget_theme_mod
引入
1.5.0
棄用
3.4.0

get_theme: 這個函式用來獲取當前的主題物件。它可以接受一個字串引數作為主題名稱或主題目錄路徑。如果沒有提供引數,該函式將返回基於當前使用的模板的當前主題物件。

檢索主題資料。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function get_theme( $theme ) {
_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme( $stylesheet )' );
$themes = get_themes();
if ( is_array( $themes ) && array_key_exists( $theme, $themes ) )
return $themes[ $theme ];
return null;
}
function get_theme( $theme ) { _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme( $stylesheet )' ); $themes = get_themes(); if ( is_array( $themes ) && array_key_exists( $theme, $themes ) ) return $themes[ $theme ]; return null; }
function get_theme( $theme ) {
	_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme( $stylesheet )' );

	$themes = get_themes();
	if ( is_array( $themes ) && array_key_exists( $theme, $themes ) )
		return $themes[ $theme ];
	return null;
}

常見問題

FAQs
檢視更多 >