Make WordPress Core


Ignore:
Timestamp:
01/04/2022 07:11:24 PM (3 years ago)
Author:
ryelle
Message:

Administration: Refresh the Dashboard Welcome panel.

With its last major update in 3.5, the welcome panel was feeling stale. This bright new design showcases links to recent features, including patterns, the site editor, and styles, depending on whether you have a block theme active.

Props jameskoster, desrosj, noisysocks, critterverse, karmatosed, hellofromtonya, smit08, melchoyce, poena, audrasjb, webcommsat, marybaum.
See #54489.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/dashboard.php

    r52330 r52442  
    19911991 */
    19921992function wp_welcome_panel() {
    1993     $customize_url          = null;
    1994     $can_edit_theme_options = current_user_can( 'edit_theme_options' );
    1995     $can_customize          = current_user_can( 'customize' );
    1996     $is_block_theme         = wp_is_block_theme();
    1997 
    1998     if ( $is_block_theme && $can_edit_theme_options ) {
    1999         $customize_url = esc_url( admin_url( 'site-editor.php' ) );
    2000     } elseif ( ! $is_block_theme && $can_customize ) {
    2001         $customize_url = wp_customize_url();
    2002     }
     1993    list( $display_version ) = explode( '-', get_bloginfo( 'version' ) );
     1994    $can_customize           = current_user_can( 'customize' );
     1995    $is_block_theme          = wp_is_block_theme();
    20031996    ?>
    20041997    <div class="welcome-panel-content">
    2005     <h2><?php _e( 'Welcome to WordPress!' ); ?></h2>
    2006     <p class="about-description"><?php _e( 'We&#8217;ve assembled some links to get you started:' ); ?></p>
     1998    <div class="welcome-panel-header">
     1999        <h2><?php _e( 'Welcome to WordPress!' ); ?></h2>
     2000        <p>
     2001            <a href="<?php echo esc_url( admin_url( 'about.php' ) ); ?>">
     2002            <?php
     2003                /* translators: %s: Current WordPress version. */
     2004                printf( __( 'Learn more about the %s version.' ), $display_version );
     2005            ?>
     2006            </a>
     2007        </p>
     2008    </div>
    20072009    <div class="welcome-panel-column-container">
    2008     <div class="welcome-panel-column">
    2009         <?php if ( $customize_url ) : ?>
    2010             <h3><?php _e( 'Get Started' ); ?></h3>
    2011             <a class="button button-primary button-hero load-customize hide-if-no-customize" href="<?php echo $customize_url; ?>"><?php _e( 'Customize Your Site' ); ?></a>
    2012         <?php endif; ?>
    2013         <a class="button button-primary button-hero hide-if-customize" href="<?php echo esc_url( admin_url( 'themes.php' ) ); ?>"><?php _e( 'Customize Your Site' ); ?></a>
    2014         <?php if ( current_user_can( 'install_themes' ) || ( current_user_can( 'switch_themes' ) && count( wp_get_themes( array( 'allowed' => true ) ) ) > 1 ) ) : ?>
    2015             <?php $themes_link = $can_customize && ! $is_block_theme ? add_query_arg( 'autofocus[panel]', 'themes', admin_url( 'customize.php' ) ) : admin_url( 'themes.php' ); ?>
    2016             <p class="hide-if-no-customize">
    2017                 <?php
    2018                     /* translators: %s: URL to Themes panel in Customizer or Themes screen. */
    2019                     printf( __( 'or, <a href="%s">change your theme completely</a>' ), $themes_link );
    2020                 ?>
    2021             </p>
    2022         <?php endif; ?>
    2023     </div>
    2024     <div class="welcome-panel-column">
    2025         <h3><?php _e( 'Next Steps' ); ?></h3>
    2026         <ul>
    2027         <?php if ( 'page' === get_option( 'show_on_front' ) && ! get_option( 'page_for_posts' ) ) : ?>
    2028             <li><?php printf( '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Edit your front page' ) . '</a>', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?></li>
    2029             <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
    2030         <?php elseif ( 'page' === get_option( 'show_on_front' ) ) : ?>
    2031             <li><?php printf( '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Edit your front page' ) . '</a>', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?></li>
    2032             <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
    2033             <li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Add a blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li>
    2034         <?php else : ?>
    2035             <li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Write your first blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li>
    2036             <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add an About page' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
    2037             <li><?php printf( '<a href="%s" class="welcome-icon welcome-setup-home">' . __( 'Set up your homepage' ) . '</a>', current_user_can( 'customize' ) ? add_query_arg( 'autofocus[section]', 'static_front_page', admin_url( 'customize.php' ) ) : admin_url( 'options-reading.php' ) ); ?></li>
    2038         <?php endif; ?>
    2039             <li><?php printf( '<a href="%s" class="welcome-icon welcome-view-site">' . __( 'View your site' ) . '</a>', home_url( '/' ) ); ?></li>
    2040         </ul>
    2041     </div>
    2042     <div class="welcome-panel-column welcome-panel-last">
    2043         <h3><?php _e( 'More Actions' ); ?></h3>
    2044         <ul>
    2045         <?php if ( current_theme_supports( 'widgets' ) ) : ?>
    2046             <li><?php printf( '<a href="%s" class="welcome-icon welcome-widgets">' . __( 'Manage widgets' ) . '</a>', admin_url( 'widgets.php' ) ); ?></li>
    2047         <?php endif; ?>
    2048         <?php if ( current_theme_supports( 'menus' ) ) : ?>
    2049             <li><?php printf( '<a href="%s" class="welcome-icon welcome-menus">' . __( 'Manage menus' ) . '</a>', admin_url( 'nav-menus.php' ) ); ?></li>
    2050         <?php endif; ?>
    2051         <?php if ( current_user_can( 'manage_options' ) ) : ?>
    2052             <li><?php printf( '<a href="%s" class="welcome-icon welcome-comments">' . __( 'Turn comments on or off' ) . '</a>', admin_url( 'options-discussion.php' ) ); ?></li>
    2053         <?php endif; ?>
    2054             <li><?php printf( '<a href="%s" class="welcome-icon welcome-learn-more">' . __( 'Learn more about getting started' ) . '</a>', __( 'https://wordpress.org/support/article/first-steps-with-wordpress/' ) ); ?></li>
    2055         </ul>
    2056     </div>
     2010        <div class="welcome-panel-column">
     2011            <div class="welcome-panel-icon-pages"></div>
     2012            <div class="welcome-panel-column-content">
     2013                <h3><?php _e( 'Author rich content with blocks and patterns' ); ?></h3>
     2014                <p><?php _e( 'Block patterns are pre-configured block layouts. Use them to get inspired or create new pages in a flash.' ); ?></p>
     2015                <a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=page' ) ); ?>"><?php _e( 'Add a new page' ); ?></a>
     2016            </div>
     2017        </div>
     2018        <div class="welcome-panel-column">
     2019            <div class="welcome-panel-icon-layout"></div>
     2020            <div class="welcome-panel-column-content">
     2021            <?php if ( $is_block_theme ) : ?>
     2022                <h3><?php _e( 'Customize your entire site with block themes' ); ?></h3>
     2023                <p><?php _e( 'Design everything on your site &#8212; from the header down to the footer, all using blocks and patterns.' ); ?></p>
     2024                <a href="<?php echo esc_url( admin_url( 'site-editor.php' ) ); ?>"><?php _e( 'Open site editor' ); ?></a>
     2025            <?php else : ?>
     2026                <h3><?php _e( 'Start Customizing' ); ?></h3>
     2027                <p><?php _e( 'Configure your site&#8217;s logo, header, menus, and more in the Customizer.' ); ?></p>
     2028                <?php if ( $can_customize ) : ?>
     2029                    <a class="load-customize hide-if-no-customize" href="<?php echo wp_customize_url(); ?>"><?php _e( 'Open the Customizer' ); ?></a>
     2030                <?php endif; ?>
     2031            <?php endif; ?>
     2032            </div>
     2033        </div>
     2034        <div class="welcome-panel-column">
     2035            <div class="welcome-panel-icon-styles"></div>
     2036            <div class="welcome-panel-column-content">
     2037            <?php if ( $is_block_theme ) : ?>
     2038                <h3><?php _e( 'Switch up your site&#8217;s look & feel with Styles' ); ?></h3>
     2039                <p><?php _e( 'Tweak your site, or give it a whole new look! Get creative &#8212; how about a new color palette or font?' ); ?></p>
     2040                <a href="<?php echo esc_url( admin_url( 'site-editor.php?styles=open' ) ); ?>"><?php _e( 'Edit styles' ); ?></a>
     2041            <?php else : ?>
     2042                <h3><?php _e( 'Discover a new way to build your site.' ); ?></h3>
     2043                <p><?php _e( 'There&#8217;s a new kind of WordPress theme, called a block theme, that lets you build the site you&#8217;ve always wanted &#8212; with blocks and styles.' ); ?></p>
     2044                <a href="<?php echo esc_url( __( 'https://wordpress.org/support/article/block-themes/' ) ); ?>"><?php _e( 'Learn about block themes' ); ?></a>
     2045            <?php endif; ?>
     2046            </div>
     2047        </div>
    20572048    </div>
    20582049    </div>
Note: See TracChangeset for help on using the changeset viewer.