Make WordPress Core


Ignore:
Timestamp:
09/14/2023 01:11:29 AM (21 months ago)
Author:
joedolson
Message:

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

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

Props costdev, joedolson.
See #57791.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-privacy-policy-content.php

    r56499 r56571  
    353353            );
    354354        } else {
    355             ?>
    356             <div class="notice notice-warning inline wp-pp-notice">
    357                 <p>
    358                 <?php
    359                 echo $message;
    360                 printf(
    361                     ' <a href="%s" target="_blank">%s <span class="screen-reader-text">%s</span></a>',
    362                     $url,
    363                     $label,
    364                     /* translators: Hidden accessibility text. */
    365                     __( '(opens in a new tab)' )
    366                 );
    367                 ?>
    368                 </p>
    369             </div>
    370             <?php
     355            $message .= sprintf(
     356                ' <a href="%s" target="_blank">%s <span class="screen-reader-text">%s</span></a>',
     357                $url,
     358                $label,
     359                /* translators: Hidden accessibility text. */
     360                __( '(opens in a new tab)' )
     361            );
     362            wp_admin_notice(
     363                $message,
     364                array(
     365                    'type'               => 'warning',
     366                    'additional_classes' => array( 'inline', 'wp-pp-notice' ),
     367                )
     368            );
    371369        }
    372370    }
     
    395393
    396394                /* translators: %s: Date of plugin deactivation. */
    397                 $removed = __( 'You deactivated this plugin on %s and may no longer need this policy.' );
    398                 $removed = '<div class="notice notice-info inline"><p>' . sprintf( $removed, $date ) . '</p></div>';
     395                $removed = sprintf( __( 'You deactivated this plugin on %s and may no longer need this policy.' ), $date );
     396                $removed = wp_get_admin_notice(
     397                    $removed,
     398                    array(
     399                        'type'               => 'info',
     400                        'additional_classes' => array( 'inline' ),
     401                    )
     402                );
    399403            } elseif ( ! empty( $section['updated'] ) ) {
    400404                $badge_class = ' blue';
Note: See TracChangeset for help on using the changeset viewer.