Make WordPress Core


Ignore:
Timestamp:
09/16/2023 09:47:22 PM (3 years ago)
Author:
costdev
Message:

Administration: Increase wp_admin_notice() usage in /wp-includes/.

Adds further usages of wp_admin_notice() in the root level of /wp-includes/ on .error and .notice-info.

Ongoing task to implement new function across core.

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

Props joedolson, costdev.
See #57791.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/widgets/class-wp-widget-text.php

    r56196 r56597  
    496496                                <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
    497497                        </p>
    498                         <div class="notice inline notice-info notice-alt">
    499                                 <?php if ( ! isset( $instance['visual'] ) ) : ?>
    500                                         <p><?php _e( 'This widget may contain code that may work better in the &#8220;Custom HTML&#8221; widget. How about trying that widget instead?' ); ?></p>
    501                                 <?php else : ?>
    502                                         <p><?php _e( 'This widget may have contained code that may work better in the &#8220;Custom HTML&#8221; widget. If you have not yet, how about trying that widget instead?' ); ?></p>
    503                                 <?php endif; ?>
    504                         </div>
     498                        <?php
     499                        if ( ! isset( $instance['visual'] ) ) {
     500                                $widget_info_message = __( 'This widget may contain code that may work better in the &#8220;Custom HTML&#8221; widget. How about trying that widget instead?' );
     501                        } else {
     502                                $widget_info_message = __( 'This widget may have contained code that may work better in the &#8220;Custom HTML&#8221; widget. If you have not yet, how about trying that widget instead?' );
     503                        }
     504
     505                        wp_admin_notice(
     506                                $widget_info_message,
     507                                array(
     508                                        'type'               => 'info',
     509                                        'additional_classes' => array( 'notice-alt', 'inline' ),
     510                                )
     511                        );
     512                        ?>
    505513                        <p>
    506514                                <label for="<?php echo $this->get_field_id( 'text' ); ?>"><?php _e( 'Content:' ); ?></label>
Note: See TracChangeset for help on using the changeset viewer.