Make WordPress Core

Ticket #33388: 33388.2.diff

File 33388.2.diff, 1.3 KB (added by Thomas Vitale, 7 years ago)

Patch refreshed

  • src/wp-includes/class-wp-theme.php

    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 { 
    11301130                        $files = (array) $this->get_files( 'php', 1, true );
    11311131
    11321132                        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'] ) )
    11341135                                        continue;
    11351136                                }
    11361137
    11371138                                $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'] );
    11401142                                }
    11411143
    11421144                                foreach ( $types as $type ) {
    final class WP_Theme implements ArrayAccess { 
    11451147                                                $post_templates[ $type ] = array();
    11461148                                        }
    11471149
    1148                                         $post_templates[ $type ][ $file ] = _cleanup_header_comment( $header[1] );
     1150                                        $post_templates[ $type ][ $file ] = $header['Template Name']; ;
    11491151                                }
    11501152                        }
    11511153