wpseek.com
WordPress开发者和主题制作者的搜索引擎
get_file_description › WordPress Function
Since1.5.0
已弃用n/a
› get_file_description ( $file )
| 参数: |
|
| 返回: |
|
| 定义在: |
|
| 文档: |
Gets the description for standard WordPress theme files.
Related Functions: term_description, get_the_archive_description, get_the_author_description, tag_description, the_archive_description
源码
function get_file_description( $file ) {
global $wp_file_descriptions, $allowed_files;
$dirname = pathinfo( $file, PATHINFO_DIRNAME );
$file_path = $allowed_files[ $file ];
if ( isset( $wp_file_descriptions[ basename( $file ) ] ) && '.' === $dirname ) {
return $wp_file_descriptions[ basename( $file ) ];
} elseif ( file_exists( $file_path ) && is_file( $file_path ) ) {
$template_data = implode( '', file( $file_path ) );
if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) ) {
/* translators: %s: Template name. */
return sprintf( __( '%s Page Template' ), _cleanup_header_comment( $name[1] ) );
}
}
return trim( basename( $file ) );
}