Make WordPress Core


Ignore:
Timestamp:
07/01/2026 06:08:42 PM (3 months ago)
Author:
scruffian
Message:

Toolbar: Show the site icon in the admin bar when one is set.

When a site icon is configured, it is displayed in the WordPress admin bar in place of the home/odometer dashicon. The icon is shown at 20×20px with a border-radius of 2px. When no site icon is set, the existing dashicon behavior is preserved.

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

Props fushar, tyxla, joen, wildworks, scruffian, sergeybiryukov, lucasmdo, joedolson.
Fixes #65088. See #46657, #64308.

File:
1 edited

Legend:

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

    r62592 r62614  
    456456        width: 64px;
    457457        height: 64px;
    458         border-radius: 50%;
    459458}
    460459
    … …  
    483482#wpadminbar #wp-admin-bar-my-account.with-avatar > a img {
    484483        width: auto;
    485         height: 20px;
     484        height: 16px;
    486485        padding: 0;
    487         border: 1px solid #2c353b;
    488         border-radius: 50%;
     486        border: 1px solid #8c8f94;
    489487        background: #f0f0f1;
    490488        line-height: 1.84615384;
    … …  
    540538}
    541539
     540#wpadminbar .quicklinks li img.blavatar {
     541        border-radius: 2px;
     542}
     543
    542544#wpadminbar .quicklinks li div.blavatar:before {
    543545        content: "\f120";
    … …  
    583585        content: "\f102";
    584586        content: "\f102" / '';
     587}
     588
     589#wpadminbar #wp-admin-bar-site-name.has-site-icon > .ab-item {
     590        display: flex;
     591        align-items: center;
     592        gap: 6px;
     593}
     594
     595#wpadminbar #wp-admin-bar-site-name.has-site-icon > .ab-item:before {
     596        content: none;
     597}
     598
     599#wpadminbar #wp-admin-bar-site-name > .ab-item .site-icon {
     600        width: 20px;
     601        height: 20px;
     602        background: #f0f0f1; /* matching my-account (user avatar) node's background */
     603        border-radius: 2px;
    585604}
    586605
    … …  
    906925        #wpadminbar #wp-admin-bar-edit > .ab-item:before,
    907926        #wpadminbar #wp-admin-bar-my-sites > .ab-item:before,
    908         #wpadminbar #wp-admin-bar-site-name > .ab-item:before,
     927        #wpadminbar #wp-admin-bar-site-name:not(.has-site-icon) > .ab-item:before,
    909928        #wpadminbar #wp-admin-bar-site-editor > .ab-item:before,
    910929        #wpadminbar #wp-admin-bar-customize > .ab-item:before,
    … …  
    921940        }
    922941
     942        #wpadminbar #wp-admin-bar-site-name > .ab-item .site-icon {
     943                position: absolute;
     944                top: 9px;
     945                left: 12px;
     946                width: 28px;
     947                height: 28px;
     948                margin: 0;
     949                border-radius: 4px;
     950        }
     951
    923952        #wpadminbar #wp-admin-bar-appearance {
    924953                margin-top: 0;
    … …  
    9721001                position: relative;
    9731002                white-space: nowrap;
    974                 text-indent: 150%; /* More than 100% indentation is needed since this element has padding */
     1003                text-indent: 150%; /* More than 100% indention is needed since this element has padding */
    9751004                width: 28px;
    9761005                padding: 0 10px;
    … …  
    9801009        #wpadminbar .quicklinks li#wp-admin-bar-my-account.with-avatar > a img {
    9811010                position: absolute;
    982                 top: 12px;
     1011                top: 13px;
    9831012                right: 10px;
    984                 width: 28px;
    985                 height: 28px;
    986                 border-radius: 50%;
     1013                width: 26px;
     1014                height: 26px;
    9871015        }
    9881016
Note: See TracChangeset for help on using the changeset viewer.