get_theme_data() - WordPress 函数参考中文文档

返回介绍

get_theme_data()

发布于 2017-09-11 字数2155 浏览 979 评论 0

Warning: This function has been deprecated. Use wp_get_theme() instead.

get_theme_data( string $theme_file )

Retrieve theme data from parsed theme file.


描述


参数

$theme_file

(string)
(Required)
Theme file path.


返回值

(array) Theme data.


源代码

File: wp-includes/deprecated.php

function get_theme_data( $theme_file ) {
	_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' );
	$theme = new WP_Theme( basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) );

	$theme_data = array(
		'Name' => $theme->get('Name'),
		'URI' => $theme->display('ThemeURI', true, false),
		'描述' => $theme->display('描述', true, false),
		'Author' => $theme->display('Author', true, false),
		'AuthorURI' => $theme->display('AuthorURI', true, false),
		'Version' => $theme->get('Version'),
		'Template' => $theme->get('Template'),
		'Status' => $theme->get('Status'),
		'Tags' => $theme->get('Tags'),
		'Title' => $theme->get('Name'),
		'AuthorName' => $theme->get('Author'),
	);

	foreach ( apply_filters( 'extra_theme_headers', array() ) as $extra_header ) {
		if ( ! isset( $theme_data[ $extra_header ] ) )
			$theme_data[ $extra_header ] = $theme->get( $extra_header );
	}

	return $theme_data;
}

更新日志

Version 描述
3.4.0 Use wp_get_theme()
1.5.0 Introduced.

相关函数

Uses

  • wp-includes/class-wp-theme.php:
    WP_Theme::__construct()
  • wp-includes/functions.php:
    _deprecated_function()
  • wp-includes/plugin.php:
    apply_filters()

User Contributed Notes

上一篇:get_themes()

下一篇:get_theme_feature_list()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!