Make WordPress Core


Ignore:
Timestamp:
12/04/2010 03:52:59 AM (14 years ago)
Author:
nacin
Message:

Don't even show parent theme files when viewing the child theme. see #15672.

File:
1 edited

Legend:

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

    r16712 r16714  
    126126
    127127$description = get_file_description($file);
    128 $desc_header = ( $description != $file_show ) ? "<strong>$description</strong> (%s)" : "%s";
     128$desc_header = ( $description != $file_show ) ? "$description <span>(%s)</span>" : "<span>%s</span>";
     129
     130$is_child_theme = $themes[$theme]['Template'] != $themes[$theme]['Stylesheet'];
    129131?>
    130132<div class="wrap">
     
    134136<div class="fileedit-sub">
    135137<div class="alignleft">
    136 <big><?php echo sprintf($desc_header, $file_show); ?></big>
     138<h3><?php
     139if ( $is_child_theme && strpos( $file, $themes[$theme]['Template Dir'] ) === 0 )
     140    echo $themes[$theme]['Parent Theme'] . ': ';
     141else
     142    echo $themes[$theme]['Name'] . ': ';
     143printf( $desc_header, $file_show ); ?></h3>
    137144</div>
    138145<div class="alignright">
     
    156163</div>
    157164    <div id="templateside">
    158 
    159165<?php
    160166if ($allowed_files) :
    161167?>
    162168    <h3><?php _e('Templates'); ?></h3>
     169    <?php if ( $is_child_theme ) : ?>
     170    <p class="howto"><?php printf( __( 'This child theme inherits templates from a parent theme, %s.' ), $themes[$theme]['Parent Theme'] ); ?></p>
     171    <?php endif; ?>
    163172    <ul>
    164173<?php
     
    166175    $template_dir = $themes[$theme]['Template Dir'];
    167176    foreach ( $themes[$theme]['Template Files'] as $template_file ) {
     177        // Don't show parent templates.
     178        if ( $is_child_theme && strpos( $template_file, $themes[$theme]['Template Dir'] ) === 0 )
     179            continue;
     180
    168181        $description = trim( get_file_description($template_file) );
    169182        $template_show = basename($template_file);
     
    193206    $stylesheet_dir = $themes[$theme]['Stylesheet Dir'];
    194207    foreach ( $themes[$theme]['Stylesheet Files'] as $style_file ) {
     208        // Don't show parent styles.
     209        if ( $is_child_theme && strpos( $style_file, $themes[$theme]['Template Dir'] ) === 0 )
     210            continue;
     211
    195212        $description = trim( get_file_description($style_file) );
    196213        $style_show = basename($style_file);
     
    225242
    226243        <div>
    227         <?php if ( is_child_theme() ) :
    228             if ( strpos( $file, $themes[$theme]['Template Dir'] ) === 0 ) { ?>
    229                 <p><?php if ( is_writeable( $file ) ) { ?><strong><?php _e( 'Caution:' ); ?></strong><?php } ?>
    230                 <?php printf( __( 'This is a file in your parent theme, &#8220;%s.&#8221;' ), $themes[$theme]['Parent Theme'] ); ?></p>
    231             <?php } else { ?>
    232                 <p><?php printf( __( 'This is a file in your child theme, &#8220;%s.&#8221;' ), $themes[$theme]['Name'] ); ?></p>
    233             <?php } ?>
     244        <?php if ( is_child_theme() && ! $is_child_theme && $themes[$theme]['Template'] == get_option('template') ) : ?>
     245            <p><?php if ( is_writeable( $file ) ) { ?><strong><?php _e( 'Caution:' ); ?></strong><?php } ?>
     246            <?php _e( 'This is a file in your current parent theme.' ); ?></p>
    234247        <?php endif; ?>
    235248<?php
Note: See TracChangeset for help on using the changeset viewer.