WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/19/2021 08:12:44 PM (2 weeks ago)
Author:
jffng
Message:

Twenty Twenty-Two: Sync updates from GitHub.

This commit syncs several changes for the default theme from its active development repository to core.

This is a follow up to [52081], [52107], and [52164]. It includes improvements to the home page template, adding a filter for block patterns, pre-loading the web font, improvements and bug fixes to block patterns, and more. For a full list of changes, visit https://github.com/WordPress/twentytwentytwo/compare/e4f69d0b7ed93f73b33c5991430618d01b0e3cac...25d74deaa57ba49b5a64a8569e6dd9ebadbfb23c.

Props jeffpaul, richtabor, netweb, luminuu, melchoyce, beafealho, clucasrowlands, desrosj, flixos90, joen, otto42, saju4wordpress, westonruter, kjellr, poena.
See #54318.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentytwentytwo/functions.php

    r52164 r52222  
    104104            font-style: normal;
    105105            font-stretch: normal;
     106            font-display: swap;
    106107            src: url('" . get_theme_file_uri( 'assets/fonts/SourceSerif4Variable-Roman.ttf.woff2' ) . "') format('woff2');
    107108        }
     
    112113            font-style: italic;
    113114            font-stretch: normal;
     115            font-display: swap;
    114116            src: url('" . get_theme_file_uri( 'assets/fonts/SourceSerif4Variable-Italic.ttf.woff2' ) . "') format('woff2');
    115117        }
     
    120122endif;
    121123
     124if ( ! function_exists( 'twentytwentytwo_preload_webfonts' ) ) :
     125
     126    /**
     127     * Preloads the main web font to improve performance.
     128     *
     129     * Only the main web font (font-style: normal) is preloaded here since that font is always relevant (e.g. it used
     130     * on every heading). The other font is only needed if there is any applicable content in italic style, and
     131     * therefore preloading it would in most cases regress performance when that font would otherwise not be loaded at
     132     * all.
     133     *
     134     * @since Twenty Twenty-Two 1.0
     135     *
     136     * @return void
     137     */
     138    function twentytwentytwo_preload_webfonts() {
     139        ?>
     140        <link rel="preload" href="<?php echo esc_url( get_theme_file_uri( 'assets/fonts/SourceSerif4Variable-Roman.ttf.woff2' ) ); ?>" as="font" type="font/woff2" crossorigin>
     141        <?php
     142    }
     143
     144endif;
     145
     146add_action( 'wp_head', 'twentytwentytwo_preload_webfonts' );
     147
    122148// Add block patterns
    123149require get_template_directory() . '/inc/block-patterns.php';
Note: See TracChangeset for help on using the changeset viewer.