WordPress:Function Reference/get theme data
来自站长百科
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'