- if ( 'style.css' == $filename )
- echo "\t</ul>\n\t<h3>" . _x( 'Styles', 'Theme stylesheets in theme editor' ) . "</h3>\n\t<ul>\n";
+ $file_type = substr( $filename, strrpos( $filename, '.' ) );
+
+ if ( $file_type !== $previous_file_type ) {
+ if ( '' !== $previous_file_type ) {
+ echo "\t</ul>\n";
+ }
+
+ switch ( $file_type ) {
+ case '.php':
+ if ( $has_templates || $theme->parent() ) :
+ echo "\t<h2>" . __( 'Templates' ) . "</h2>\n";
+ if ( $theme->parent() ) {
+ echo '<p class="howto">' . sprintf( __( 'This child theme inherits templates from a parent theme, %s.' ),
+ sprintf( '<a href="%s">%s</a>',
+ self_admin_url( 'theme-editor.php?theme=' . urlencode( $theme->get_template() ) ),
+ $theme->parent()->display( 'Name' )
+ )
+ ) . "</p>\n";
+ }
+ endif;
+ break;
+ case '.css':
+ echo "\t<h2>" . _x( 'Styles', 'Theme stylesheets in theme editor' ) . "</h2>\n";
+ break;
+ default:
+ /* translators: %s: file extension */
+ echo "\t<h2>" . sprintf( __( '%s files' ), $file_type ) . "</h2>\n";
+ break;
+ }
+
+ echo "\t<ul>\n";
+ }