Make WordPress Core


Ignore:
Timestamp:
09/17/2023 03:21:07 PM (20 months ago)
Author:
costdev
Message:

Administration: Use wp_admin_notice() more in /wp-admin/includes/.

Adds further usages of wp_admin_notice() in /wp-admin/includes/ on .notice-error, .notice-warning, .error, and .updated.

Ongoing task to implement new function across core.

Follow-up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597].

Props joedolson, mukesh27, costdev.
See #57791.

File:
1 edited

Legend:

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

    r56548 r56599  
    574574    <form name="post" action="<?php echo esc_url( admin_url( 'post.php' ) ); ?>" method="post" id="quick-press" class="initial-form hide-if-no-js">
    575575
    576         <?php if ( $error_msg ) : ?>
    577         <div class="error"><?php echo $error_msg; ?></div>
    578         <?php endif; ?>
     576        <?php
     577        if ( $error_msg ) {
     578            wp_admin_notice(
     579                $error_msg,
     580                array(
     581                    'additional_classes' => array( 'error' ),
     582                )
     583            );
     584        }
     585        ?>
    579586
    580587        <div class="input-text-wrap" id="title-wrap">
     
    11581165 */
    11591166function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array(), ...$args ) {
    1160     $loading    = '<p class="widget-loading hide-if-no-js">' . __( 'Loading&hellip;' ) . '</p><div class="hide-if-js notice notice-error inline"><p>' . __( 'This widget requires JavaScript.' ) . '</p></div>';
    11611167    $doing_ajax = wp_doing_ajax();
     1168    $loading    = '<p class="widget-loading hide-if-no-js">' . __( 'Loading&hellip;' ) . '</p>';
     1169    $loading   .= wp_get_admin_notice(
     1170        __( 'This widget requires JavaScript.' ),
     1171        array(
     1172            'type'               => 'error',
     1173            'additional_classes' => array( 'inline', 'hide-if-js' ),
     1174        )
     1175    );
    11621176
    11631177    if ( empty( $check_urls ) ) {
     
    13411355 */
    13421356function wp_print_community_events_markup() {
    1343     ?>
    1344 
    1345     <div class="community-events-errors notice notice-error inline hide-if-js">
    1346         <p class="hide-if-js">
    1347             <?php _e( 'This widget requires JavaScript.' ); ?>
    1348         </p>
    1349 
    1350         <p class="community-events-error-occurred" aria-hidden="true">
    1351             <?php _e( 'An error occurred. Please try again.' ); ?>
    1352         </p>
    1353 
    1354         <p class="community-events-could-not-locate" aria-hidden="true"></p>
    1355     </div>
    1356 
    1357     <div class="community-events-loading hide-if-no-js">
    1358         <?php _e( 'Loading&hellip;' ); ?>
    1359     </div>
    1360 
    1361     <?php
     1357    $community_events_notice  = '<p class="hide-if-js">' . ( 'This widget requires JavaScript.' ) . '</p>';
     1358    $community_events_notice .= '<p class="community-events-error-occurred" aria-hidden="true">' . __( 'An error occurred. Please try again.' ) . '</p>';
     1359    $community_events_notice .= '<p class="community-events-could-not-locate" aria-hidden="true"></p>';
     1360
     1361    wp_admin_notice(
     1362        $community_events_notice,
     1363        array(
     1364            'type'               => 'error',
     1365            'additional_classes' => array( 'community-events-errors', 'inline', 'hide-if-js' ),
     1366            'paragraph_wrap'     => false,
     1367        )
     1368    );
     1369
    13621370    /*
    13631371     * Hide the main element when the page first loads, because the content
Note: See TracChangeset for help on using the changeset viewer.