diff --git a/src/wp-includes/class-wp-theme.php b/src/wp-includes/class-wp-theme.php
index 39ce67393f..92a68f8f6e 100644
a
|
b
|
final class WP_Theme implements ArrayAccess { |
1235 | 1235 | $files = (array) $this->get_files( 'php', 1, true ); |
1236 | 1236 | |
1237 | 1237 | foreach ( $files as $file => $full_path ) { |
1238 | | if ( ! preg_match( '|Template Name:(.*)$|mi', file_get_contents( $full_path ), $header ) ) { |
| 1238 | $header = get_file_data( $full_path, array( 'Template Name' => 'Template Name' ) ); |
| 1239 | if ( empty( $header['Template Name'] ) ) { |
1239 | 1240 | continue; |
1240 | 1241 | } |
1241 | 1242 | |
1242 | 1243 | $types = array( 'page' ); |
1243 | | if ( preg_match( '|Template Post Type:(.*)$|mi', file_get_contents( $full_path ), $type ) ) { |
1244 | | $types = explode( ',', _cleanup_header_comment( $type[1] ) ); |
| 1244 | $type = get_file_data( $full_path, array( 'Template Post Type' => 'Template Post Type' ) ); |
| 1245 | if ( empty( $header['Template Post Type'] ) ) { |
| 1246 | $types = explode( ',', $type['Template Post Type'] ); |
1245 | 1247 | } |
1246 | 1248 | |
1247 | 1249 | foreach ( $types as $type ) { |
… |
… |
final class WP_Theme implements ArrayAccess { |
1250 | 1252 | $post_templates[ $type ] = array(); |
1251 | 1253 | } |
1252 | 1254 | |
1253 | | $post_templates[ $type ][ $file ] = _cleanup_header_comment( $header[1] ); |
| 1255 | $post_templates[ $type ][ $file ] = $header['Template Name']; |
1254 | 1256 | } |
1255 | 1257 | } |
1256 | 1258 | |