Make WordPress Core

Changeset 62943


Ignore:
Timestamp:
07/30/2026 02:54:34 PM (9 days ago)
Author:
afercia
Message:

Administration: Fix the alignment of the 'Update to' button in the 'At a Glance' Dashboard widget.

Updates the CSS for the 'At a Glance' dashboard widget to use a flexbox layout so the Core update button stays within the widget container and better aligns to the version text.

Also, fixes the DOM order and the visual order so that they match.

Developed in https://github.com/WordPress/wordpress-develop/pull/12715

Props khokansardar, joedolson, afercia.
Fixes #65733.

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

Legend:

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

    r62681 r62943  
    725725}
    726726
     727#dashboard_right_now #wp-version-message {
     728        display: flex;
     729        flex-wrap: wrap;
     730        align-items: center;
     731        gap: 8px;
     732}
     733
     734#dashboard_right_now #wp-version {
     735        flex: 1;
     736}
     737
    727738#dashboard_right_now #wp-version-message .button {
    728         float: right;
    729         position: relative;
    730         top: -5px;
    731         margin-left: 5px;
     739        margin-left: auto;
    732740}
    733741
  • trunk/src/wp-admin/includes/update.php

    r61594 r62943  
    363363        }
    364364
    365         $msg = '';
    366 
    367         if ( current_user_can( 'update_core' ) ) {
    368                 $cur = get_preferred_from_update_core();
    369 
    370                 if ( isset( $cur->response ) && 'upgrade' === $cur->response ) {
    371                         $msg .= sprintf(
    372                                 '<a href="%s" class="button" aria-describedby="wp-version">%s</a> ',
    373                                 network_admin_url( 'update-core.php' ),
    374                                 /* translators: %s: WordPress version number, or 'Latest' string. */
    375                                 sprintf( __( 'Update to %s' ), $cur->current ? $cur->current : __( 'Latest' ) )
    376                         );
    377                 }
    378         }
    379 
    380365        /* translators: 1: Version number, 2: Theme name. */
    381366        $content = __( 'WordPress %1$s running %2$s theme.' );
     
    392377        $content = apply_filters( 'update_right_now_text', $content );
    393378
    394         $msg .= sprintf( '<span id="wp-version">' . $content . '</span>', get_bloginfo( 'version', 'display' ), $theme_name );
     379        $msg = sprintf( '<span id="wp-version">' . $content . '</span>', get_bloginfo( 'version', 'display' ), $theme_name );
     380
     381        if ( current_user_can( 'update_core' ) ) {
     382                $cur = get_preferred_from_update_core();
     383
     384                if ( isset( $cur->response ) && 'upgrade' === $cur->response ) {
     385                        $msg .= sprintf(
     386                                '<a href="%s" class="button" aria-describedby="wp-version">%s</a>',
     387                                network_admin_url( 'update-core.php' ),
     388                                /* translators: %s: WordPress version number, or 'Latest' string. */
     389                                sprintf( __( 'Update to %s' ), $cur->current ? $cur->current : __( 'Latest' ) )
     390                        );
     391                }
     392        }
    395393
    396394        echo "<p id='wp-version-message'>$msg</p>";
Note: See TracChangeset for help on using the changeset viewer.