Make WordPress Core

Changeset 20041


Ignore:
Timestamp:
02/29/2012 08:18:53 PM (13 years ago)
Author:
nacin
Message:

Translate page template names! Have WP_Theme::get_page_templates() return templates keyed by filename, not by template name, as it makes more sense. Flip this in get_page_templates() to be compatible. fixes #6007.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/theme.php

    r20029 r20041  
    8282 */
    8383function get_page_templates() {
    84     return wp_get_theme()->get_page_templates();
     84    return array_flip( wp_get_theme()->get_page_templates() );
    8585}
    8686
  • trunk/wp-includes/class-wp-theme.php

    r20039 r20041  
    922922
    923923        foreach ( $files['php'] as $file ) {
    924             $headers = get_file_data( $file, array( 'Name' => 'Template Name' ) );
    925             if ( empty( $headers['Name'] ) )
     924            $headers = get_file_data( $file, array( 'Template Name' => 'Template Name' ) );
     925            if ( empty( $headers['Template Name'] ) )
    926926                continue;
    927             $page_templates[ $headers['Name'] ] = basename( $file );
     927            $page_templates[ basename( $file ) ] = $this->translate_header( 'Template Name', $headers['Template Name'] );
    928928        }
    929929
Note: See TracChangeset for help on using the changeset viewer.