Make WordPress Core


Ignore:
Timestamp:
10/02/2013 08:49:59 PM (10 years ago)
Author:
nacin
Message:

Show a proper error message on the dashboard when the current theme is broken.

Clean up Appearance -> Themes when we don't have enough information to show for a broken theme.

Clean up broken/ugly "alt" row styling when we are displaying broken themes.

props johnbillion for initial patch.
fixes #21670.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/themes.php

    r25616 r25666  
    139139        <?php echo $ct->display('Name'); ?>
    140140    </h4>
     141
     142<?php
     143if ( $ct->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) {
     144    echo '<p class="error-message">' . sprintf( __( 'ERROR: %s' ), $ct->errors()->get_error_message() ) . '</p>';
     145}
     146
     147// Certain error codes are less fatal than others. We can still display theme information in most cases.
     148if ( ! $ct->errors() || ( 1 == count( $ct->errors()->get_error_codes() )
     149    && in_array( $ct->errors()->get_error_code(), array( 'theme_no_parent', 'theme_parent_invalid', 'theme_no_index' ) ) ) ) : ?>
    141150
    142151    <div>
     
    208217    ?>
    209218
     219<?php endif; // theme errors ?>
     220
    210221</div>
    211222
     
    293304    </tr>
    294305<?php
    295     $alt = '';
    296306    foreach ( $broken_themes as $broken_theme ) {
    297         $alt = ('class="alternate"' == $alt) ? '' : 'class="alternate"';
    298307        echo "
    299         <tr $alt>
     308        <tr>
    300309             <td>" . $broken_theme->get('Name') ."</td>
    301310             <td>" . $broken_theme->errors()->get_error_message() . "</td>
Note: See TracChangeset for help on using the changeset viewer.