Making WordPress.org


Ignore:
Timestamp:
03/04/2021 10:14:17 PM (5 years ago)
Author:
coffee2code
Message:

Handbooks, Admin Notices: Ensure suggested post slugs are not repeated.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/admin-notices.php

    r10748 r10749  
    4242                ) {
    4343                        echo '<div class="notice notice-success"><p>';
     44
     45                        $suggested_slugs = array_unique( [
     46                                str_replace( '-handbook', '', $current_screen->post_type ),
     47                                'welcome',
     48                                $current_screen->post_type,
     49                                'handbook',
     50                        ] );
     51                        $suggested_slugs = array_map( function( $x ) { return "<code>{$x}</code>"; }, $suggested_slugs );
     52
    4453                        printf(
    4554                                /* translators: 1: example landing page title that includes post type name, 2: comma-separated list of acceptable post slugs */
    4655                                __( '<strong>Welcome to your new handbook!</strong> It is recommended that the first post you create is the landing page for the handbook. You can title it anything you like (suggestions: <code>%1$s</code> or <code>Welcome</code>). However, you must ensure that it has one of the following slugs: %2$s.', 'wporg' ),
    4756                                WPorg_Handbook::get_name( $current_screen->post_type ),
    48                                 '<code>' . str_replace( '-handbook', '', $current_screen->post_type ) . '</code>, <code>welcome</code>, <code>' . $current_screen->post_type . '</code>, <code>handbook</code>'
     57                                implode( ', ', $suggested_slugs )
    4958                        );
    5059                        echo "</p></div>\n";
Note: See TracChangeset for help on using the changeset viewer.