WordPress:Function Reference/get theme data

来自站长百科
Fludlen讨论 | 贡献2008年7月21日 (一) 17:13的版本
跳转至: 导航、​ 搜索

Description

描述

Returns an array of information about a theme file.

返回主题文件的一组信息。

Usage

用法

%%% <?php $theme_data = get_theme_data($theme_filename); ?> %%%

%%% <?php $theme_data = get_theme_data($theme_filename); ?> %%%

Example

例子

Usage

用法

Get the information from the default themes style.css and display the Name and author linked with there respective URIs if they exist.

从默认主题style.css中得到信息,并且如果存在的话,显示名称和链接进的作者,以及相关的URIs。

<?php
    $theme_data = get_theme_data(ABSPATH . 'wp-content/themes/default/style.css');
    echo $theme_data['Title'];
    echo $theme_data['Author'];
?>
<?php
    $theme_data = get_theme_data(ABSPATH . 'wp-content/themes/default/style.css');
    echo $theme_data['Title'];
    echo $theme_data['Author'];
?>

Parameters

参数

Return values

返回值

The function returns an array containing the following keyed information.

函数返回一个数组,包含下面键入的信息。

'Name'
(string) The Themes name.
'Name'
(string)主题名。
'Title'
(string) Either the Theme's name or a HTML fragment containg the Theme's name linked to the Theme's URI if the Theme's URI is defined.
'Title'
(string)如果定义了主题URI,主题名或者包含主题名的HTML段,会链接到主题的URI。
'Description'
(string) A HTML fragment containg the Themes description after it has passed through wptexturize.
'描述'
(string)通过wptexturize传递后,包含主题描述的HTML片段。
'Author'
(string) Either the Author's name or a HTML fragment containg the Author's name linked to the Author's URI if the Author's URI is defined.
'Author'
(string)如果定义了作者的URI,作者名或者包含作者名的HTML片段会链接到作者URI。
'Version'
(string) The Theme's version number.
'Version'
(string)主题的版本数字。
'Template'
(string) The name of the parent Theme if one exists.
'Template'
(string)如果存在母主题,这是母主题的名称。
'Status'
(string) defaults to 'publish'
'Status'
(string)默认为'发表'