Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #20718


Ignore:
Timestamp:
05/21/2012 10:15:47 AM (12 years ago)
Author:
SergeyBiryukov
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #20718 – Description

    initial v1  
    11When there's a custom page template named "something.php" defined with
    2 
     2{{{
    33/*
    44Template Name: Something
    55*/
    6 
     6}}}
    77On the theme editor, the file list supposed to returns:
    8 
     8{{{
    99"Something"
    1010(something.php)
    11 
     11}}}
    1212where it is displaying only the file name:
    13 
     13{{{
    1414"something.php"
    15 
     15}}}
    1616Well it doesn't affect the functionality but it IS annoying.
    1717
     
    2222
    2323where:
    24 
     24{{{
    2525        elseif ( file_exists( $file ) && is_file( $file ) ) {
    2626                $template_data = implode( '', file( $file ) );
    2727                if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ))
    2828                        return sprintf( __( '%s Page Template' ), _cleanup_header_comment($name[1]) );
    29 
     29}}}
    3030Well, it will always returns the filename instead of the template name since it will never find the $file on the defined path.
    3131
    3232It should be something like:
    33 
     33{{{
    3434        elseif ( file_exists( get_template_directory() . '/' . $file ) && is_file( get_template_directory() . '/' . $file ) ) {
    3535                $template_data = implode( '', file( get_template_directory() . '/' . $file ) );
     
    3737                        return sprintf( __( '%s Page Template' ), _cleanup_header_comment($name[1]) );
    3838
    39 
     39}}}
    4040Again, it's nothing but annoying