Make WordPress Core

Changeset 56572

Timestamp:
09/14/2023 01:23:37 AM (11 months ago)
Author:
joedolson
Message:

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

Add usages of wp_admin_notice() and wp_get_admin_notice() on .notice-[type] in the root level of /wp-includes/. Ongoing task to implement new function across core.

Props costdev, joedolson.
See #57791.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/customize/class-wp-customize-theme-control.php

    r52978 r56572  
    241241                    </div>
    242242                </div>
    243                 <div class="notice notice-success notice-alt"><p><?php _ex( 'Installed', 'theme' ); ?></p></div>
     243                <?php
     244                wp_admin_notice(
     245                    _x( 'Installed', 'theme' ),
     246                    array(
     247                        'type'               => 'success',
     248                        'additional_classes' => array( 'notice-alt' ),
     249                    )
     250                );
     251                ?>
    244252            <# } else if ( 'installed' === data.theme.type ) { #>
    245253                <# if ( data.theme.blockTheme ) { #>
     
    256264                        </div>
    257265                    </div>
    258                     <div class="notice notice-error notice-alt"><p>
    259                     <?php
    260                         _e( 'This theme doesn\'t support Customizer.' );
    261                     ?>
     266                    <?php $customizer_not_supported_message = __( 'This theme doesn\'t support Customizer.' ); ?>
    262267                    <# if ( data.theme.actions.activate ) { #>
    263268                        <?php
    264                             echo ' ';
    265                             printf(
     269                            $customizer_not_supported_message .= ' ' . sprintf(
    266270                                /* translators: %s: URL to the themes page (also it activates the theme). */
    267271                                __( 'However, you can still <a href="%s">activate this theme</a>, and use the Site Editor to customize it.' ),
     
    270274                        ?>
    271275                    <# } #>
    272                     </p></div>
     276
     277                    <?php
     278                    wp_admin_notice(
     279                        $customizer_not_supported_message,
     280                        array(
     281                            'type'               => 'error',
     282                            'additional_classes' => array( 'notice-alt' ),
     283                        )
     284                    );
     285                    ?>
    273286                <# } else { #>
    274287                    <div class="theme-id-container">
     
    282295                        </div>
    283296                    </div>
    284                     <div class="notice notice-success notice-alt"><p><?php _ex( 'Installed', 'theme' ); ?></p></div>
     297                    <?php
     298                    wp_admin_notice(
     299                        _x( 'Installed', 'theme' ),
     300                        array(
     301                            'type'               => 'success',
     302                            'additional_classes' => array( 'notice-alt' ),
     303                        )
     304                    );
     305                    ?>
    285306                <# } #>
    286307            <# } else { #>
  • trunk/src/wp-includes/user.php

    r56559 r56572  
    37623762        $email = get_user_meta( get_current_user_id(), '_new_email', true );
    37633763        if ( $email ) {
    3764             /* translators: %s: New email address. */
    3765             echo '<div class="notice notice-info"><p>' . sprintf( __( 'Your email address has not been updated yet. Please check your inbox at %s for a confirmation email.' ), '<code>' . esc_html( $email['newemail'] ) . '</code>' ) . '</p></div>';
     3764            $message = sprintf(
     3765                /* translators: %s: New email address. */
     3766                __( 'Your email address has not been updated yet. Please check your inbox at %s for a confirmation email.' ),
     3767                '<code>' . esc_html( $email['newemail'] ) . '</code>'
     3768            );
     3769            wp_admin_notice( $message, array( 'type' => 'info' ) );
    37663770        }
    37673771    }
Note: See TracChangeset for help on using the changeset viewer.