Revert detection of page templates to 3.3 functionality.
WP_Theme in 3.4.0 used get_file_data(), which is far too strict when compared to the original regular expression in get_page_templates(). This causes missing templates when, for example, the PHP comment starts on the same line as the header. see #20955 for trunk. git-svn-id: https://develop.svn.wordpress.org/trunk@21117 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
95159b0788
commit
4d33587bdc
|
@ -930,10 +930,9 @@ final class WP_Theme implements ArrayAccess {
|
||||||
$files = (array) $this->get_files( 'php', 1 );
|
$files = (array) $this->get_files( 'php', 1 );
|
||||||
|
|
||||||
foreach ( $files as $file => $full_path ) {
|
foreach ( $files as $file => $full_path ) {
|
||||||
$headers = get_file_data( $full_path, array( 'Template Name' => 'Template Name' ) );
|
if ( ! preg_match( '|Template Name:(.*)$|mi', file_get_contents( $full_path ), $header ) )
|
||||||
if ( empty( $headers['Template Name'] ) )
|
|
||||||
continue;
|
continue;
|
||||||
$page_templates[ $file ] = $headers['Template Name'];
|
$page_templates[ $file ] = _cleanup_header_comment( $header[1] );
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->cache_add( 'page_templates', $page_templates );
|
$this->cache_add( 'page_templates', $page_templates );
|
||||||
|
|
Loading…
Reference in New Issue