WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/01/2015 10:05:17 PM (7 years ago)
Author:
helen
Message:

Admin notices: Make (most) core notices dismissible.

These no longer return upon refreshing the page when JS is on and working, so users should be able to dismiss them. This is particularly important on the post edit screen when DFW is triggered, but pretty much all notices can be dismissed if needed. A post on Make/Core will follow with information on how this can be leveraged in plugins.

props valendesigns, afercia, paulwilde, adamsilverstein, helen.
fixes #31233. see #23367.

File:
1 edited

Legend:

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

    r31941 r31973  
    275275        $message = _n( '%s theme enabled.', '%s themes enabled.', $enabled );
    276276    }
    277     echo '<div id="message" class="updated"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>';
     277    echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>';
    278278} elseif ( isset( $_GET['disabled'] ) ) {
    279279    $disabled = absint( $_GET['disabled'] );
     
    283283        $message = _n( '%s theme disabled.', '%s themes disabled.', $disabled );
    284284    }
    285     echo '<div id="message" class="updated"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>';
     285    echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>';
    286286} elseif ( isset( $_GET['deleted'] ) ) {
    287287    $deleted = absint( $_GET['deleted'] );
     
    291291        $message = _n( '%s theme deleted.', '%s themes deleted.', $deleted );
    292292    }
    293     echo '<div id="message" class="updated"><p>' . sprintf( $message, number_format_i18n( $deleted ) ) . '</p></div>';
     293    echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $deleted ) ) . '</p></div>';
    294294} elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) {
    295     echo '<div id="message" class="error"><p>' . __( 'No theme selected.' ) . '</p></div>';
     295    echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'No theme selected.' ) . '</p></div>';
    296296} elseif ( isset( $_GET['error'] ) && 'main' == $_GET['error'] ) {
    297     echo '<div class="error"><p>' . __( 'You cannot delete a theme while it is active on the main site.' ) . '</p></div>';
     297    echo '<div class="error notice is-dismissible"><p>' . __( 'You cannot delete a theme while it is active on the main site.' ) . '</p></div>';
    298298}
    299299
Note: See TracChangeset for help on using the changeset viewer.