WordPress:Function Reference/get theme data

来自站长百科
Xxf3325讨论 | 贡献2008年7月19日 (六) 15:16的版本 (新页面: == Description == Returns an array of information about a theme file. == Usage == %%% <?php $theme_data = get_theme_data($theme_filename); ?> %%% == Example == === Usage === Get the...)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航、​ 搜索

Description

Returns an array of information about a theme file.

Usage

%%% <?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.

<?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.
'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.
'Description'
(string) A HTML fragment containg the Themes description after it has passed through wptexturize.
'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.
'Version'
(string) The Theme's version number.
'Template'
(string) The name of the parent Theme if one exists.
'Status'
(string) defaults to 'publish'