WordPress.org

Make WordPress Core

Changeset 49247


Ignore:
Timestamp:
10/20/2020 06:24:33 PM (15 months ago)
Author:
desrosj
Message:

Twenty Twenty: Import the latest changes from GitHub

For a full list of changes since [49216], see https://github.com/WordPress/twentytwentyone/compare/dfe141276ca4b856bbcd748f9da108ddad026c4c...trunk/.

Props poena, melchoyce, luminuu, aristath, jffng, ryelle, kishanjasani, rolfsiebers, sresok, desrosj.
See #51526.

Location:
trunk/src/wp-content/themes/twentytwentyone
Files:
13 added
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentytwentyone/assets/css/ie-editor.css

    r49216 r49247  
    3333/* OS dark theme preference */
    3434@media (prefers-color-scheme: dark) {
    35     html.has-default-light-palette-background body {
     35    html.respect-color-scheme-preference body {
    3636        background-color: #28303d;
    3737    }
    3838    @media (prefers-color-scheme: dark){
    39         html.has-default-light-palette-background body{
     39        html.respect-color-scheme-preference body{
    4040        background-color: #28303d;
    4141        }
     
    21982198}
    21992199
    2200 table.wp-calendar-table thead {
    2201     border: 1px solid #28303d;
    2202 }
    2203 
     2200table.wp-calendar-table thead,
    22042201table.wp-calendar-table tbody {
    2205     border: 1px solid #28303d;
     2202    color: currentColor;
     2203    border: 1px solid;
    22062204}
    22072205
     
    22102208    text-align: left;
    22112209    margin-bottom: 20px;
     2210    color: currentColor;
    22122211}
    22132212
  • trunk/src/wp-content/themes/twentytwentyone/assets/css/ie.css

    r49216 r49247  
    77Description: Twenty Twenty-One is a blank canvas for your ideas and it makes the block editor your best brush. With new block patterns, which allow you to create a beautiful layout in a matter of seconds, this theme’s soft colors and eye-catching — yet timeless — design will let your work shine. Take it for a spin! See how Twenty Twenty-One elevates your portfolio, business website, or personal blog.
    88Requires at least: 5.3
    9 Tested up to: 5.5
     9Tested up to: 5.6
    1010Requires PHP: 5.6
    1111Version: 1.0.0
     
    125125/* OS dark theme preference */
    126126@media (prefers-color-scheme: dark) {
    127     html.has-default-light-palette-background body {
     127    html.respect-color-scheme-preference body {
    128128        background-color: #28303d;
    129129    }
    130130    @media (prefers-color-scheme: dark){
    131         html.has-default-light-palette-background body{
     131        html.respect-color-scheme-preference body{
    132132        background-color: #28303d;
    133133        }
     
    13651365.entry-content > *.alignleft, .entry-content > *.alignright,
    13661366.entry-content > *.alignleft:first-child + *,
    1367 .entry-content > *.alignright:first-child + *, .entry-content > *.alignfull {
     1367.entry-content > *.alignright:first-child + *, .entry-content > *.alignfull.has-background {
    13681368    margin-top: 0;
    13691369}
    13701370
    1371 .entry-content > *:last-child, .entry-content > *.alignfull {
     1371.entry-content > *:last-child, .entry-content > *.alignfull.has-background {
    13721372    margin-bottom: 0;
    13731373}
     
    42504250}
    42514251
    4252 table.wp-calendar-table thead {
    4253     border: 1px solid #28303d;
    4254 }
    4255 
     4252table.wp-calendar-table thead,
    42564253table.wp-calendar-table tbody {
    4257     border: 1px solid #28303d;
     4254    color: currentColor;
     4255    border: 1px solid;
    42584256}
    42594257
     
    42624260    text-align: left;
    42634261    margin-bottom: 20px;
     4262    color: currentColor;
    42644263}
    42654264
     
    48104809    color: #28303d;
    48114810    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    4812     font-size: 1rem;
     4811    font-size: 1.125rem;
    48134812    line-height: 1.7;
    48144813    border-top: 3px solid #28303d;
     
    57065705        height: 100vh;
    57075706        z-index: 499;
     5707        border: 2px solid transparent;
    57085708    }
    57095709    .has-logo.has-title-and-tagline .primary-navigation > .primary-menu-container {
     
    57165716    .admin-bar .primary-navigation > .primary-menu-container {
    57175717        height: calc(100vh - 46px);
     5718    }
     5719    .primary-navigation > .primary-menu-container:focus {
     5720        border: 2px solid #28303d;
    57185721    }
    57195722}
     
    63616364    padding-bottom: 10px;
    63626365    color: #28303d;
    6363     font-size: 1rem;
     6366    font-size: 1.125rem;
    63646367    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    63656368}
  • trunk/src/wp-content/themes/twentytwentyone/assets/css/style-editor.css

    r49216 r49247  
    165165    --footer--color-link-hover: var(--global--color-primary-hover);
    166166    --footer--font-family: var(--global--font-primary);
    167     --footer--font-size: var(--global--font-size-xs);
     167    --footer--font-size: var(--global--font-size-sm);
    168168    /* Block: Pull quote */
    169169    --pullquote--font-family: var(--global--font-primary);
     
    211211/* OS dark theme preference */
    212212@media (prefers-color-scheme: dark) {
    213     html.has-default-light-palette-background {
     213    html.respect-color-scheme-preference {
    214214        --global--color-background: var(--global--color-dark-gray);
    215215        --global--color-primary: var(--global--color-light-gray);
     
    221221        --button--color-background-active: var(--global--color-background);
    222222    }
    223     html.has-default-light-palette-background body {
     223    html.respect-color-scheme-preference body {
    224224        background-color: var(--global--color-background);
    225225    }
     
    15901590table.wp-calendar-table thead,
    15911591table.wp-calendar-table tbody {
    1592     border: 1px solid var(--global--color-dark-gray);
     1592    color: currentColor;
     1593    border: 1px solid;
    15931594}
    15941595
     
    15971598    text-align: left;
    15981599    margin-bottom: var(--global--spacing-unit);
     1600    color: currentColor;
    15991601}
    16001602
  • trunk/src/wp-content/themes/twentytwentyone/assets/js/primary-navigation.js

    r49216 r49247  
    3939 * @param {Element} el - The element.
    4040 */
    41 function twentytwentyoneExpandSubMenu( el ) { // jshint ignore:line
     41function twentytwentyoneExpandSubMenu( el ) { // eslint-disable-line no-unused-vars
    4242    // Close submenu that was opened from a hover action.
    4343    // We'll return early in this case to avoid changing the aria-expanded attribute.
  • trunk/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-custom-colors.php

    r49216 r49247  
    3333
    3434    /**
    35      * Determine the luminance of the given color and then return #fff or #000 so that our text is always readable.
     35     * Determine the luminance of the given color and then return #fff or #000 so that the text is always readable.
    3636     *
    3737     * @access public
     
    4444     */
    4545    public function custom_get_readable_color( $background_color ) {
    46         return ( 127 < $this->get_relative_luminance_from_hex( $background_color ) ) ? '#000' : '#fff';
     46        return ( 127 < self::get_relative_luminance_from_hex( $background_color ) ) ? '#000' : '#fff';
    4747    }
    4848
     
    116116            (string) filemtime( get_theme_file_path( 'assets/css/custom-color-overrides.css' ) )
    117117        );
    118         if ( 'd1e4dd' !== strtolower( get_theme_mod( 'background_color', 'D1E4DD' ) ) ) {
     118
     119        $background_color = get_theme_mod( 'background_color', 'D1E4DD' );
     120        if ( 'd1e4dd' !== strtolower( $background_color ) ) {
    119121            wp_add_inline_style( 'twenty-twenty-one-custom-color-overrides', $this->generate_custom_color_variables( 'editor' ) );
     122        }
     123
     124        $should_respect_color_scheme = get_theme_mod( 'respect_user_color_preference', true ); // @phpstan-ignore-line. Passing true instead of default value of false to get_theme_mod.
     125        if ( $should_respect_color_scheme && self::get_relative_luminance_from_hex( $background_color ) > 127 ) {
     126            // Add dark mode variable overrides.
     127            wp_add_inline_style( 'twenty-twenty-one-custom-color-overrides', '@media (prefers-color-scheme: dark) { :root .editor-styles-wrapper { --global--color-background: var(--global--color-dark-gray); --global--color-primary: var(--global--color-light-gray); --global--color-secondary: var(--global--color-light-gray); } }' );
    120128        }
    121129    }
     
    123131    /**
    124132     * Get luminance from a HEX color.
     133     *
     134     * @static
    125135     *
    126136     * @access public
     
    132142     * @return int Returns a number (0-255).
    133143     */
    134     public function get_relative_luminance_from_hex( $hex ) {
     144    public static function get_relative_luminance_from_hex( $hex ) {
    135145
    136146        // Remove the "#" symbol from the beginning of the color.
    137147        $hex = ltrim( $hex, '#' );
    138148
    139         // Make sure we have 6 digits for the below calculations.
     149        // Make sure there are 6 digits for the below calculations.
    140150        if ( 3 === strlen( $hex ) ) {
    141151            $hex = substr( $hex, 0, 1 ) . substr( $hex, 0, 1 ) . substr( $hex, 1, 1 ) . substr( $hex, 1, 1 ) . substr( $hex, 2, 1 ) . substr( $hex, 2, 1 );
     
    165175    public function body_class( $classes ) {
    166176        $background_color = get_theme_mod( 'background_color', 'D1E4DD' );
    167         if ( 127 > $this->get_relative_luminance_from_hex( $background_color ) ) {
     177        if ( 127 > self::get_relative_luminance_from_hex( $background_color ) ) {
    168178            $classes[] = 'is-background-dark';
    169179        } else {
     
    171181        }
    172182
    173         $light_colors_default_palette = array( '#D1E4DD', '#D1DFE4', '#D1D1E4', '#E4D1D1', '#E4DAD1', '#EEEADD', '#FFFFFF' );
    174         if ( in_array( strtoupper( '#' . ltrim( $background_color, '#' ) ), $light_colors_default_palette, true ) ) {
    175             $classes[] = 'has-default-light-palette-background';
    176         }
    177 
    178183        return $classes;
    179184    }
  • trunk/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-customize.php

    r49216 r49247  
    4141
    4242            // Change site-title & description to postMessage.
    43             $wp_customize->get_setting( 'blogname' )->transport        = 'postMessage';
    44             $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
     43            $wp_customize->get_setting( 'blogname' )->transport        = 'postMessage'; // @phpstan-ignore-line. Assume that this setting exists.
     44            $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; // @phpstan-ignore-line. Assume that this setting exists.
    4545
    4646            // Add partial for blogname.
     
    127127            $palette = get_theme_support( 'editor-color-palette' );
    128128
    129             // Build the colors array from our theme-support.
     129            // Build the colors array from theme-support.
    130130            $colors = array();
    131131            if ( isset( $palette[0] ) && is_array( $palette[0] ) ) {
     
    147147                )
    148148            );
     149
     150            $wp_customize->add_setting(
     151                'respect_user_color_preference',
     152                array(
     153                    'capability'        => 'edit_theme_options',
     154                    'default'           => true,
     155                    'sanitize_callback' => function( $value ) {
     156                        return (bool) $value;
     157                    },
     158                )
     159            );
     160
     161            $wp_customize->add_control(
     162                'respect_user_color_preference',
     163                array(
     164                    'type'            => 'checkbox',
     165                    'section'         => 'colors',
     166                    'label'           => esc_html__( 'Respect visitor\'s device dark mode settings', 'twentytwentyone' ),
     167                    'description'     => __( 'Dark mode is a device setting. If a visitor to your site requests it, your site will be shown with a dark background and light text.', 'twentytwentyone' ),
     168                    'active_callback' => function( $value ) {
     169                        return 127 < Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( get_theme_mod( 'background_color', 'D1E4DD' ) );
     170                    },
     171                )
     172            );
    149173        }
    150174
  • trunk/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-svg-icons.php

    r49216 r49247  
    188188        }
    189189
     190        // @phpstan-ignore-next-line.
    190191        return $svg;
    191192    }
  • trunk/src/wp-content/themes/twentytwentyone/comments.php

    r49216 r49247  
    1515/*
    1616 * If the current post is protected by a password and
    17  * the visitor has not yet entered the password we will
     17 * the visitor has not yet entered the password,
    1818 * return early without loading the comments.
    1919 */
  • trunk/src/wp-content/themes/twentytwentyone/functions.php

    r49216 r49247  
    4141        /*
    4242         * Let WordPress manage the document title.
    43          * By adding theme support, we declare that this theme does not use a
    44          * hard-coded <title> tag in the document head, and expect WordPress to
    45          * provide it for us.
     43         * This theme does not use a hard-coded <title> tag in the document head,
     44         * WordPress will provide it for us.
    4645         */
    4746        add_theme_support( 'title-tag' );
     
    127126        // Add support for editor styles.
    128127        add_theme_support( 'editor-styles' );
     128        $background_color = get_theme_mod( 'background_color', 'D1E4DD' );
     129        if ( 127 > Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( $background_color ) ) {
     130            add_theme_support( 'dark-editor-style' );
     131        }
    129132
    130133        $editor_stylesheet_path = './assets/css/style-editor.css';
     
    146149                array(
    147150                    'name'      => esc_html__( 'Extra small', 'twentytwentyone' ),
    148                     'shortName' => esc_html__( 'XS', 'twentytwentyone' ),
     151                    'shortName' => esc_html_x( 'XS', 'Font size', 'twentytwentyone' ),
    149152                    'size'      => 16,
    150153                    'slug'      => 'extra-small',
     
    152155                array(
    153156                    'name'      => esc_html__( 'Small', 'twentytwentyone' ),
    154                     'shortName' => esc_html__( 'S', 'twentytwentyone' ),
     157                    'shortName' => esc_html_x( 'S', 'Font size', 'twentytwentyone' ),
    155158                    'size'      => 18,
    156159                    'slug'      => 'small',
     
    158161                array(
    159162                    'name'      => esc_html__( 'Normal', 'twentytwentyone' ),
    160                     'shortName' => esc_html__( 'M', 'twentytwentyone' ),
     163                    'shortName' => esc_html_x( 'M', 'Font size', 'twentytwentyone' ),
    161164                    'size'      => 20,
    162165                    'slug'      => 'normal',
     
    164167                array(
    165168                    'name'      => esc_html__( 'Large', 'twentytwentyone' ),
    166                     'shortName' => esc_html__( 'L', 'twentytwentyone' ),
     169                    'shortName' => esc_html_x( 'L', 'Font size', 'twentytwentyone' ),
    167170                    'size'      => 24,
    168171                    'slug'      => 'large',
     
    170173                array(
    171174                    'name'      => esc_html__( 'Extra Large', 'twentytwentyone' ),
    172                     'shortName' => esc_html__( 'XL', 'twentytwentyone' ),
     175                    'shortName' => esc_html_x( 'XL', 'Font size', 'twentytwentyone' ),
    173176                    'size'      => 40,
    174177                    'slug'      => 'extra-large',
     
    176179                array(
    177180                    'name'      => esc_html__( 'Huge', 'twentytwentyone' ),
    178                     'shortName' => esc_html__( 'XXL', 'twentytwentyone' ),
     181                    'shortName' => esc_html_x( 'XXL', 'Font size', 'twentytwentyone' ),
    179182                    'size'      => 96,
    180183                    'slug'      => 'huge',
     
    182185                array(
    183186                    'name'      => esc_html__( 'Gigantic', 'twentytwentyone' ),
    184                     'shortName' => esc_html__( 'XXXL', 'twentytwentyone' ),
     187                    'shortName' => esc_html_x( 'XXXL', 'Font size', 'twentytwentyone' ),
    185188                    'size'      => 144,
    186189                    'slug'      => 'gigantic',
     
    523526function twentytwentyone_customize_preview_init() {
    524527    wp_enqueue_script(
     528        'twentytwentyone-customize-helpers',
     529        get_theme_file_uri( '/assets/js/customize-helpers.js' ),
     530        array(),
     531        wp_get_theme()->get( 'Version' ),
     532        true
     533    );
     534
     535    wp_enqueue_script(
    525536        'twentytwentyone-customize-preview',
    526537        get_theme_file_uri( '/assets/js/customize-preview.js' ),
    527         array( 'customize-preview', 'customize-selective-refresh', 'jquery' ),
    528         get_theme_file_path( 'assets/js/customize-preview.js' ),
     538        array( 'customize-preview', 'customize-selective-refresh', 'jquery', 'twentytwentyone-customize-helpers' ),
     539        wp_get_theme()->get( 'Version' ),
    529540        true
    530541    );
     
    532543add_action( 'customize_preview_init', 'twentytwentyone_customize_preview_init' );
    533544
    534 /**
    535  * Calculate any classes we may want to add to the main <html> element.
     545
     546/**
     547 * Enqueue scripts for the customizer.
     548 *
     549 * @since 1.0.0
     550 *
     551 * @return void
     552 */
     553function twentytwentyone_customize_controls_enqueue_scripts() {
     554
     555    wp_enqueue_script(
     556        'twentytwentyone-customize-helpers',
     557        get_theme_file_uri( '/assets/js/customize-helpers.js' ),
     558        array(),
     559        wp_get_theme()->get( 'Version' ),
     560        true
     561    );
     562
     563    wp_enqueue_script(
     564        'twentytwentyone-customize-controls',
     565        get_theme_file_uri( '/assets/js/customize.js' ),
     566        array( 'customize-base', 'customize-controls', 'underscore', 'jquery', 'twentytwentyone-customize-helpers' ),
     567        wp_get_theme()->get( 'Version' ),
     568        true
     569    );
     570
     571    wp_localize_script(
     572        'twentytwentyone-customize-controls',
     573        'backgroundColorNotice',
     574        array(
     575            'message' => esc_html__( 'You currently have dark mode enabled on your device. Changing the color picker will allow you to preview light mode.', 'twentytwentyone' ),
     576        )
     577    );
     578}
     579add_action( 'customize_controls_enqueue_scripts', 'twentytwentyone_customize_controls_enqueue_scripts' );
     580
     581/**
     582 * Calculate classes for the main <html> element.
    536583 *
    537584 * @since 1.0.0
     
    540587 */
    541588function twentytwentyone_the_html_classes() {
    542     $background_color             = get_theme_mod( 'background_color', 'D1E4DD' );
    543     $light_colors_default_palette = array( '#D1E4DD', '#D1DFE4', '#D1D1E4', '#E4D1D1', '#E4DAD1', '#EEEADD', '#FFFFFF' );
    544     if ( in_array( strtoupper( '#' . ltrim( $background_color, '#' ) ), $light_colors_default_palette, true ) ) {
    545         echo 'class="has-default-light-palette-background"';
    546     }
    547 }
     589    $background_color            = get_theme_mod( 'background_color', 'D1E4DD' );
     590    $should_respect_color_scheme = get_theme_mod( 'respect_user_color_preference', true );
     591    if ( $should_respect_color_scheme && 127 <= Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( $background_color ) ) {
     592        echo 'class="respect-color-scheme-preference"';
     593    }
     594}
  • trunk/src/wp-content/themes/twentytwentyone/header.php

    r49216 r49247  
    11<?php
    22/**
    3  * The header for our theme
     3 * The header.
    44 *
    55 * This is the template that displays all of the <head> section and everything up until main.
  • trunk/src/wp-content/themes/twentytwentyone/image.php

    r49216 r49247  
    4343                    'before'   => '<nav class="page-links" aria-label="' . esc_attr__( 'Page', 'twentytwentyone' ) . '">',
    4444                    'after'    => '</nav>',
    45                     /* translators: There is a space after page. */
    46                     'pagelink' => esc_html__( 'Page ', 'twentytwentyone' ) . '%',
     45                    /* translators: %: page number. */
     46                    'pagelink' => esc_html__( 'Page %', 'twentytwentyone' ),
    4747                )
    4848            );
     
    102102    </article><!-- #post-## -->
    103103    <?php
    104     // If comments are open or we have at least one comment, load up the comment template.
     104    // If comments are open or there is at least one comment, load up the comment template.
    105105    if ( comments_open() || get_comments_number() ) {
    106106        comments_template();
  • trunk/src/wp-content/themes/twentytwentyone/inc/back-compat.php

    r49216 r49247  
    4040    printf(
    4141        /* translators: %s: WordPress Version. */
    42         esc_html__( 'This theme requires at least WordPress version 5.3. You are running version %s. Please upgrade and try again.', 'twentytwentyone' ),
     42        esc_html__( 'This theme requires WordPress 5.3 or newer. You are running version %s. Please upgrade.', 'twentytwentyone' ),
    4343        esc_html( $GLOBALS['wp_version'] )
    4444    );
     
    5959        sprintf(
    6060            /* translators: %s: WordPress Version. */
    61             esc_html__( 'This theme requires at least WordPress version 5.3. You are running version %s. Please upgrade and try again.', 'twentytwentyone' ),
     61            esc_html__( 'This theme requires WordPress 5.3 or newer. You are running version %s. Please upgrade.', 'twentytwentyone' ),
    6262            esc_html( $GLOBALS['wp_version'] )
    6363        ),
     
    8484            sprintf(
    8585                /* translators: %s: WordPress Version. */
    86                 esc_html__( 'This theme requires at least WordPress version 5.3. You are running version %s. Please upgrade and try again.', 'twentytwentyone' ),
     86                esc_html__( 'This theme requires WordPress 5.3 or newer. You are running version %s. Please upgrade.', 'twentytwentyone' ),
    8787                esc_html( $GLOBALS['wp_version'] )
    8888            )
  • trunk/src/wp-content/themes/twentytwentyone/inc/custom-css.php

    r49216 r49247  
    2424function twenty_twenty_one_generate_css( $selector, $style, $value, $prefix = '', $suffix = '', $echo = true ) {
    2525
    26     // Bail early if we have no $selector elements or properties and $value.
     26    // Bail early if there is no $selector elements or properties and $value.
    2727    if ( ! $value || ! $selector ) {
    2828        return '';
     
    3535         * Note to reviewers: $css contains auto-generated CSS.
    3636         * It is included inside <style> tags and can only be interpreted as CSS on the browser.
    37          * Using wp_strip_all_tags() here is sufficient escaping since we just need to avoid
     37         * Using wp_strip_all_tags() here is sufficient escaping to avoid
    3838         * malicious attempts to close </style> and open a <script>.
    3939         */
  • trunk/src/wp-content/themes/twentytwentyone/inc/template-functions.php

    r49216 r49247  
    271271 */
    272272function twenty_twenty_one_change_calendar_nav_arrows( $calendar_output ) {
    273     $calendar_output = str_replace( '&laquo; ', twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ), $calendar_output );
    274     $calendar_output = str_replace( ' &raquo;', twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' ), $calendar_output );
     273    $calendar_output = str_replace( '&laquo; ', is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ), $calendar_output );
     274    $calendar_output = str_replace( ' &raquo;', is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' ), $calendar_output );
    275275    return $calendar_output;
    276276}
     
    382382
    383383    // Return the specified styles.
    384     return twenty_twenty_one_generate_css(
     384    return twenty_twenty_one_generate_css( // @phpstan-ignore-line.
    385385        implode( ',', $elements[ $type ] ),
    386386        'font-family',
     
    399399 * @param string      $block_name The full block type name, or a partial match.
    400400 *                                Example: `core/image`, `core-embed/*`.
    401  * @param string|null $content    The content we need to search in. Use null for get_the_content().
    402  * @param int         $instances  How many instances of the block we want to print. Defaults to 1.
     401 * @param string|null $content    The content to search in. Use null for get_the_content().
     402 * @param int         $instances  How many instances of the block will be printed (max). Defaults to 1.
    403403 *
    404404 * @return bool Returns true if a block was located & printed, otherwise false.
     
    423423        }
    424424
    425         // Check if this the block we're looking for.
     425        // Check if this the block matches the $block_name.
    426426        $is_matching_block = false;
    427427
    428         // If the block ends with *, we should just try to match the first portion.
     428        // If the block ends with *, try to match the first portion.
    429429        if ( '*' === $block_name[-1] ) {
    430430            $is_matching_block = 0 === strpos( $block['blockName'], rtrim( $block_name, '*' ) );
     
    440440            $blocks_content .= render_block( $block );
    441441
    442             // Break the loop if we've reached the $instances count.
     442            // Break the loop if the $instances count was reached.
    443443            if ( $instances_count >= $instances ) {
    444444                break;
  • trunk/src/wp-content/themes/twentytwentyone/inc/template-tags.php

    r49216 r49247  
    7474        if ( ! is_single() ) {
    7575
     76            if ( is_sticky() ) {
     77                echo '<p>' . esc_html__( 'Featured post', 'twentytwentyone' ) . '</p>';
     78            }
     79
    7680            $post_format = get_post_format();
    7781            if ( 'aside' === $post_format || 'status' === $post_format ) {
  • trunk/src/wp-content/themes/twentytwentyone/page.php

    r49216 r49247  
    1717    get_template_part( 'template-parts/content/content-page' );
    1818
    19     // If comments are open or we have at least one comment, load up the comment template.
     19    // If comments are open or there is at least one comment, load up the comment template.
    2020    if ( comments_open() || get_comments_number() ) {
    2121        comments_template();
  • trunk/src/wp-content/themes/twentytwentyone/single.php

    r49216 r49247  
    2828    }
    2929
    30     // If comments are open or we have at least one comment, load up the comment template.
     30    // If comments are open or there is at least one comment, load up the comment template.
    3131    if ( comments_open() || get_comments_number() ) {
    3232        comments_template();
  • trunk/src/wp-content/themes/twentytwentyone/style-rtl.css

    r49216 r49247  
    257257    --footer--color-link-hover: var(--global--color-primary-hover);
    258258    --footer--font-family: var(--global--font-primary);
    259     --footer--font-size: var(--global--font-size-xs);
     259    --footer--font-size: var(--global--font-size-sm);
    260260    /* Block: Pull quote */
    261261    --pullquote--font-family: var(--global--font-primary);
     
    303303/* OS dark theme preference */
    304304@media (prefers-color-scheme: dark) {
    305     html.has-default-light-palette-background {
     305    html.respect-color-scheme-preference {
    306306        --global--color-background: var(--global--color-dark-gray);
    307307        --global--color-primary: var(--global--color-light-gray);
     
    313313        --button--color-background-active: var(--global--color-background);
    314314    }
    315     html.has-default-light-palette-background body {
     315    html.respect-color-scheme-preference body {
    316316        background-color: var(--global--color-background);
    317317    }
     
    10051005.entry-content > *.alignleft, .entry-content > *.alignright,
    10061006.entry-content > *.alignleft:first-child + *,
    1007 .entry-content > *.alignright:first-child + *, .entry-content > *.alignfull {
     1007.entry-content > *.alignright:first-child + *, .entry-content > *.alignfull.has-background {
    10081008    margin-top: 0;
    10091009}
    10101010
    1011 .entry-content > *:last-child, .entry-content > *.alignfull {
     1011.entry-content > *:last-child, .entry-content > *.alignfull.has-background {
    10121012    margin-bottom: 0;
    10131013}
     
    29742974table.wp-calendar-table thead,
    29752975table.wp-calendar-table tbody {
    2976     border: 1px solid var(--global--color-dark-gray);
     2976    color: currentColor;
     2977    border: 1px solid;
    29772978}
    29782979
     
    29812982    text-align: right;
    29822983    margin-bottom: var(--global--spacing-unit);
     2984    color: currentColor;
    29832985}
    29842986
     
    40674069        height: 100vh;
    40684070        z-index: 499;
     4071        border: 2px solid transparent;
    40694072    }
    40704073    .has-logo.has-title-and-tagline .primary-navigation > .primary-menu-container {
     
    40774080    .admin-bar .primary-navigation > .primary-menu-container {
    40784081        height: calc(100vh - 46px);
     4082    }
     4083    .primary-navigation > .primary-menu-container:focus {
     4084        border: 2px solid var(--global--color-primary);
    40794085    }
    40804086}
  • trunk/src/wp-content/themes/twentytwentyone/style.css

    r49216 r49247  
    257257    --footer--color-link-hover: var(--global--color-primary-hover);
    258258    --footer--font-family: var(--global--font-primary);
    259     --footer--font-size: var(--global--font-size-xs);
     259    --footer--font-size: var(--global--font-size-sm);
    260260    /* Block: Pull quote */
    261261    --pullquote--font-family: var(--global--font-primary);
     
    303303/* OS dark theme preference */
    304304@media (prefers-color-scheme: dark) {
    305     html.has-default-light-palette-background {
     305    html.respect-color-scheme-preference {
    306306        --global--color-background: var(--global--color-dark-gray);
    307307        --global--color-primary: var(--global--color-light-gray);
     
    313313        --button--color-background-active: var(--global--color-background);
    314314    }
    315     html.has-default-light-palette-background body {
     315    html.respect-color-scheme-preference body {
    316316        background-color: var(--global--color-background);
    317317    }
     
    10091009.entry-content > *.alignleft, .entry-content > *.alignright,
    10101010.entry-content > *.alignleft:first-child + *,
    1011 .entry-content > *.alignright:first-child + *, .entry-content > *.alignfull {
     1011.entry-content > *.alignright:first-child + *, .entry-content > *.alignfull.has-background {
    10121012    margin-top: 0;
    10131013}
    10141014
    1015 .entry-content > *:last-child, .entry-content > *.alignfull {
     1015.entry-content > *:last-child, .entry-content > *.alignfull.has-background {
    10161016    margin-bottom: 0;
    10171017}
     
    29782978table.wp-calendar-table thead,
    29792979table.wp-calendar-table tbody {
    2980     border: 1px solid var(--global--color-dark-gray);
     2980    color: currentColor;
     2981    border: 1px solid;
    29812982}
    29822983
     
    29852986    text-align: left;
    29862987    margin-bottom: var(--global--spacing-unit);
     2988    color: currentColor;
    29872989}
    29882990
     
    40764078        height: 100vh;
    40774079        z-index: 499;
     4080        border: 2px solid transparent;
    40784081    }
    40794082    .has-logo.has-title-and-tagline .primary-navigation > .primary-menu-container {
     
    40864089    .admin-bar .primary-navigation > .primary-menu-container {
    40874090        height: calc(100vh - 46px);
     4091    }
     4092    .primary-navigation > .primary-menu-container:focus {
     4093        border: 2px solid var(--global--color-primary);
    40884094    }
    40894095}
  • trunk/src/wp-content/themes/twentytwentyone/template-parts/content/content-page.php

    r49216 r49247  
    3333                'before'   => '<nav class="page-links" aria-label="' . esc_attr__( 'Page', 'twentytwentyone' ) . '">',
    3434                'after'    => '</nav>',
    35                 /* translators: There is a space after page. */
    36                 'pagelink' => esc_html__( 'Page ', 'twentytwentyone' ) . '%',
     35                /* translators: %: page number. */
     36                'pagelink' => esc_html__( 'Page %', 'twentytwentyone' ),
    3737            )
    3838        );
  • trunk/src/wp-content/themes/twentytwentyone/template-parts/content/content-single.php

    r49216 r49247  
    2727                'before'   => '<nav class="page-links" aria-label="' . esc_attr__( 'Page', 'twentytwentyone' ) . '">',
    2828                'after'    => '</nav>',
    29                 /* translators: There is a space after page. */
    30                 'pagelink' => esc_html__( 'Page ', 'twentytwentyone' ) . '%',
     29                /* translators: %: page number. */
     30                'pagelink' => esc_html__( 'Page %', 'twentytwentyone' ),
    3131            )
    3232        );
  • trunk/src/wp-content/themes/twentytwentyone/template-parts/content/content.php

    r49216 r49247  
    2626        <?php
    2727        the_content(
    28             sprintf(
    29                 twenty_twenty_one_continue_reading_text(),
    30                 get_the_title()
    31             )
     28            twenty_twenty_one_continue_reading_text()
    3229        );
    3330
     
    3633                'before'   => '<nav class="page-links" aria-label="' . esc_attr__( 'Page', 'twentytwentyone' ) . '">',
    3734                'after'    => '</nav>',
    38                 /* translators: There is a space after page. */
    39                 'pagelink' => esc_html__( 'Page ', 'twentytwentyone' ) . '%',
     35                /* translators: %: page number. */
     36                'pagelink' => esc_html__( 'Page %', 'twentytwentyone' ),
    4037            )
    4138        );
  • trunk/src/wp-content/themes/twentytwentyone/template-parts/excerpt/excerpt-chat.php

    r49216 r49247  
    1111
    1212// If there are paragraph blocks, print up to two.
    13 // Otherwise this is legacy content, and we can post the excerpt.
     13// Otherwise this is legacy content, so print the excerpt.
    1414if ( has_block( 'core/paragraph', get_the_content() ) ) {
    1515
  • trunk/src/wp-content/themes/twentytwentyone/template-parts/excerpt/excerpt-gallery.php

    r49216 r49247  
    1010 */
    1111
    12 // Print the 1st gallery we can find.
     12// Print the 1st gallery found.
    1313if ( has_block( 'core/gallery', get_the_content() ) ) {
    1414
  • trunk/src/wp-content/themes/twentytwentyone/template-parts/excerpt/excerpt-image.php

    r49216 r49247  
    1010 */
    1111
    12 // If there is no featured-image, print the first image block we can find.
     12// If there is no featured-image, print the first image block found.
    1313if (
    1414    ! twenty_twenty_one_can_show_post_thumbnail() &&
Note: See TracChangeset for help on using the changeset viewer.