Make WordPress Core


Ignore:
Timestamp:
08/17/2023 09:01:17 PM (9 months ago)
Author:
joedolson
Message:

Administration: Apply admin notice functions in multisite.

Use wp_get_admin_notice and wp_admin_notice to handle multisite settings notices.

Props costdev.
See #57791.

File:
1 edited

Legend:

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

    r55618 r56409  
    197197        $message = _n( '%s theme enabled.', '%s themes enabled.', $enabled );
    198198    }
    199     echo '<div id="message" class="notice notice-success is-dismissible"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>';
     199
     200    wp_admin_notice(
     201        sprintf( $message, number_format_i18n( $enabled ) ),
     202        array(
     203            'type'        => 'success',
     204            'dismissible' => true,
     205            'id'          => 'message',
     206        )
     207    );
    200208} elseif ( isset( $_GET['disabled'] ) ) {
    201209    $disabled = absint( $_GET['disabled'] );
     
    206214        $message = _n( '%s theme disabled.', '%s themes disabled.', $disabled );
    207215    }
    208     echo '<div id="message" class="notice notice-success is-dismissible"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>';
     216
     217    wp_admin_notice(
     218        sprintf( $message, number_format_i18n( $disabled ) ),
     219        array(
     220            'type'        => 'success',
     221            'dismissible' => true,
     222            'id'          => 'message',
     223        )
     224    );
    209225} elseif ( isset( $_GET['error'] ) && 'none' === $_GET['error'] ) {
    210     echo '<div id="message" class="notice notice-error is-dismissible"><p>' . __( 'No theme selected.' ) . '</p></div>';
     226    wp_admin_notice(
     227        __( 'No theme selected.' ),
     228        array(
     229            'type'        => 'error',
     230            'dismissible' => true,
     231            'id'          => 'message',
     232        )
     233    );
    211234}
    212235?>
Note: See TracChangeset for help on using the changeset viewer.