diff --git a/src/wp-includes/class-wp-theme.php b/src/wp-includes/class-wp-theme.php
index e18ee5ca57..d22f846f2f 100644
a
|
b
|
final class WP_Theme implements ArrayAccess { |
1130 | 1130 | $files = (array) $this->get_files( 'php', 1, true ); |
1131 | 1131 | |
1132 | 1132 | foreach ( $files as $file => $full_path ) { |
1133 | | if ( ! preg_match( '|Template Name:(.*)$|mi', file_get_contents( $full_path ), $header ) ) { |
| 1133 | $header = get_file_data( $full_path, array( 'Template Name' => 'Template Name' ) ); |
| 1134 | if ( empty( $header['Template Name'] ) ) |
1134 | 1135 | continue; |
1135 | 1136 | } |
1136 | 1137 | |
1137 | 1138 | $types = array( 'page' ); |
1138 | | if ( preg_match( '|Template Post Type:(.*)$|mi', file_get_contents( $full_path ), $type ) ) { |
1139 | | $types = explode( ',', _cleanup_header_comment( $type[1] ) ); |
| 1139 | $type = get_file_data( $full_path, array( 'Template Post Type' => 'Template Post Type' ) ); |
| 1140 | if ( empty( $header['Template Post Type'] ) ) |
| 1141 | $types = explode( ',', $type['Template Post Type'] ); |
1140 | 1142 | } |
1141 | 1143 | |
1142 | 1144 | foreach ( $types as $type ) { |
… |
… |
final class WP_Theme implements ArrayAccess { |
1145 | 1147 | $post_templates[ $type ] = array(); |
1146 | 1148 | } |
1147 | 1149 | |
1148 | | $post_templates[ $type ][ $file ] = _cleanup_header_comment( $header[1] ); |
| 1150 | $post_templates[ $type ][ $file ] = $header['Template Name']; ; |
1149 | 1151 | } |
1150 | 1152 | } |
1151 | 1153 | |