WordPress:Function Reference/get theme data
来自站长百科
描述[ ]
返回主题文件的一组信息。
用法[ ]
%%% <?php $theme_data = get_theme_data($theme_filename); ?> %%%
例子[ ]
用法[ ]
从默认主题style.css中得到信息,并且如果存在的话,显示名称和链接进的作者,以及相关的URIs。
<?php $theme_data = get_theme_data(ABSPATH . 'wp-content/themes/default/style.css'); echo $theme_data['Title']; echo $theme_data['Author']; ?>
参数[ ]
返回值[ ]
函数返回一个数组,包含下面键入的信息。
- 'Name'
- (string)主题名。
- 'Title'
- (string)如果定义了主题URI,主题名或者包含主题名的HTML段,会链接到主题的URI。
- 'Description'
- (string)通过wptexturize传递后,包含主题描述的HTML片段。
- 'Author'
- (string)如果定义了作者的URI,作者名或者包含作者名的HTML片段会链接到作者URI。
- 'Version'
- (string)主题的版本数字。
- 'Template'
- (string)如果存在母主题,这是母主题的名称。
- 'Status'
- (string)默认为'发表'