Make WordPress Core


Ignore:
Timestamp:
10/08/2019 07:05:53 PM (5 years ago)
Author:
desrosj
Message:

Bundled Themes: Update Twenty Twenty.

This brings trunk's version of Twenty Twenty in-sync with GitHub.

For a complete list of changes since [46357], see https://github.com/WordPress/twentytwenty/compare/7157870...7246fd6.

Props anlino, ianbelanger, poena, williampatton, nielslange, acosmin, netweb, joyusly, luminuu, itowhid06, cbravobernal, intimez, glauberglauber, ocean90, amolv, briceduclos, aristath, mukesh27, garrett-eclipse, audrasjb, afercia, dianeco, utsav72640, mahesh901122, tobifjellner.
See #48110.

File:
1 edited

Legend:

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

    r46357 r46445  
    2020 * WP Body Open
    2121 * Register Sidebars
    22  * Enqueue Block editor assets
    23  * Classic Editor Style
     22 * Enqueue block editor assets
     23 * Enqueue classic editor styles
    2424 * Block editor settings
    2525 */
     
    6161    set_post_thumbnail_size( 1200, 9999 );
    6262
    63     // Add custom image sizes.
     63    // Add custom image size used in Cover Template.
    6464    add_image_size( 'twentytwenty-fullscreen', 1980, 9999 );
    6565
     
    175175function twentytwenty_register_styles() {
    176176
    177     $theme_version    = wp_get_theme()->get( 'Version' );
    178     $css_dependencies = array();
    179 
    180     /**
    181     * Filter to load, unload Font Awesome CSS
    182     *
    183     * By default, only load the Font Awesome fonts if the social menu is in use or
    184     * using filter Font Awesome css be loaded
    185     *
    186     * @since 1.0.0
    187     *
    188     * @param bool Whether to load font awesome, Default false.
    189     */
    190     $load_font_awesome = apply_filters( 'twentytwenty_load_font_awesome', has_nav_menu( 'social' ) );
    191 
    192     if ( $load_font_awesome ) {
    193         wp_register_style( 'font-awesome', get_template_directory_uri() . '/assets/css/font-awesome.css', false, '5.10.2', 'all' );
    194         $css_dependencies[] = 'font-awesome';
    195     }
    196 
    197     wp_enqueue_style( 'twentytwenty-style', get_template_directory_uri() . '/style.css', $css_dependencies, $theme_version );
     177    $theme_version = wp_get_theme()->get( 'Version' );
     178
     179    wp_enqueue_style( 'twentytwenty-style', get_stylesheet_uri(), array(), $theme_version );
    198180    wp_style_add_data( 'twentytwenty-style', 'rtl', 'replace' );
    199181
     
    248230 *
    249231 * @param string $html The HTML output from get_custom_logo (core function).
     232 *
     233 * @return string $html
    250234 */
    251235function twentytwenty_get_custom_logo( $html ) {
     
    303287 */
    304288function twentytwenty_skip_link() {
    305     echo '<a class="skip-link screen-reader-text" href="#site-content">' . __( 'Skip to the content', 'twentytwenty' ) . '</a>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- core trusts translations
     289    echo '<a class="skip-link screen-reader-text" href="#site-content">' . __( 'Skip to the content', 'twentytwenty' ) . '</a>';
    306290}
    307291
     
    387371
    388372/**
    389  * Output Customizer Settings in the Classic Editor.
     373 * Output Customizer settings in the classic editor.
    390374 * Adds styles to the head of the TinyMCE iframe. Kudos to @Otto42 for the original solution.
    391375 *
    392376 * @param array $mce_init TinyMCE styles.
     377 *
     378 * @return array $mce_init TinyMCE styles.
    393379 */
    394380function twentytwenty_add_classic_editor_customizer_styles( $mce_init ) {
     
    417403    $editor_color_palette = array(
    418404        array(
    419             'name'  => esc_html__( 'Accent Color', 'twentytwenty' ),
     405            'name'  => __( 'Accent Color', 'twentytwenty' ),
    420406            'slug'  => 'accent',
    421407            'color' => twentytwenty_get_color_for_area( 'content', 'accent' ),
    422408        ),
    423409        array(
    424             'name'  => esc_html__( 'Secondary', 'twentytwenty' ),
     410            'name'  => __( 'Primary', 'twentytwenty' ),
     411            'slug'  => 'primary',
     412            'color' => twentytwenty_get_color_for_area( 'content', 'text' ),
     413        ),
     414        array(
     415            'name'  => __( 'Secondary', 'twentytwenty' ),
    425416            'slug'  => 'secondary',
    426417            'color' => twentytwenty_get_color_for_area( 'content', 'secondary' ),
    427418        ),
    428419        array(
    429             'name'  => esc_html__( 'Subtle Background', 'twentytwenty' ),
     420            'name'  => __( 'Subtle Background', 'twentytwenty' ),
    430421            'slug'  => 'subtle-background',
    431422            'color' => twentytwenty_get_color_for_area( 'content', 'borders' ),
     
    450441    }
    451442
    452     // Gutenberg Font Sizes.
     443    // Block Editor Font Sizes.
    453444    add_theme_support(
    454445        'editor-font-sizes',
    455446        array(
    456447            array(
    457                 'name'      => _x( 'Small', 'Name of the small font size in Gutenberg', 'twentytwenty' ),
    458                 'shortName' => _x( 'S', 'Short name of the small font size in the Gutenberg editor.', 'twentytwenty' ),
    459                 'size'      => 16,
     448                'name'      => _x( 'Small', 'Name of the small font size in the block editor', 'twentytwenty' ),
     449                'shortName' => _x( 'S', 'Short name of the small font size in the block editor.', 'twentytwenty' ),
     450                'size'      => 18,
    460451                'slug'      => 'small',
    461452            ),
    462453            array(
    463                 'name'      => _x( 'Regular', 'Name of the regular font size in Gutenberg', 'twentytwenty' ),
    464                 'shortName' => _x( 'M', 'Short name of the regular font size in the Gutenberg editor.', 'twentytwenty' ),
    465                 'size'      => 18,
     454                'name'      => _x( 'Regular', 'Name of the regular font size in the block editor', 'twentytwenty' ),
     455                'shortName' => _x( 'M', 'Short name of the regular font size in the block editor.', 'twentytwenty' ),
     456                'size'      => 21,
    466457                'slug'      => 'regular',
    467458            ),
    468459            array(
    469                 'name'      => _x( 'Large', 'Name of the large font size in Gutenberg', 'twentytwenty' ),
    470                 'shortName' => _x( 'L', 'Short name of the large font size in the Gutenberg editor.', 'twentytwenty' ),
     460                'name'      => _x( 'Large', 'Name of the large font size in the block editor', 'twentytwenty' ),
     461                'shortName' => _x( 'L', 'Short name of the large font size in the block editor.', 'twentytwenty' ),
    471462                'size'      => 24,
    472463                'slug'      => 'large',
    473464            ),
    474465            array(
    475                 'name'      => _x( 'Larger', 'Name of the larger font size in Gutenberg', 'twentytwenty' ),
    476                 'shortName' => _x( 'XL', 'Short name of the larger font size in the Gutenberg editor.', 'twentytwenty' ),
     466                'name'      => _x( 'Larger', 'Name of the larger font size in the block editor', 'twentytwenty' ),
     467                'shortName' => _x( 'XL', 'Short name of the larger font size in the block editor.', 'twentytwenty' ),
    477468                'size'      => 32,
    478469                'slug'      => 'larger',
     
    499490        '<a href="%1$s" class="more-link faux-button">%2$s <span class="screen-reader-text">"%3$s"</span></a>',
    500491        esc_url( get_permalink( get_the_ID() ) ),
    501         esc_html__( 'Continue reading', 'twentytwenty' ),
    502         get_the_title( get_the_ID() )
     492        __( 'Continue reading', 'twentytwenty' ),
     493        esc_html( get_the_title( get_the_ID() ) )
    503494    );
    504495}
     
    514505function twentytwenty_customize_controls_enqueue_scripts() {
    515506    $theme_version = wp_get_theme()->get( 'Version' );
     507
     508    // Add main customizer js file.
     509    wp_enqueue_script( 'twentytwenty-customize', get_template_directory_uri() . '/assets/js/customize.js', array( 'jquery' ), $theme_version, false );
    516510
    517511    // Add script for color calculations.
     
    623617        'content'       => array(
    624618            'accent'     => array(
    625                 'color'            => array( '.color-accent', '.color-accent-hover:hover', '.color-accent-hover:focus', '.has-accent-color', '.has-drop-cap:not(:focus):first-letter', '.wp-block-button.is-style-outline', 'a' ),
    626                 'border-color'     => array( 'blockquote', '.border-color-accent', '.border-color-accent-hover:hover', '.border-color-accent-hover:focus' ),
    627                 'background'       => array( 'button:not(.toggle)', '.button', '.faux-button', '.wp-block-button__link', '.wp-block-file__button', 'input[type="button"]', 'input[type="reset"]', 'input[type="submit"]' ),
    628                 'background-color' => array( '.bg-accent', '.bg-accent-hover:hover', '.bg-accent-hover:focus', '.has-accent-background-color', '.comment-reply-link' ),
    629                 'fill'             => array( '.fill-children-accent', '.fill-children-accent *' ),
     619                'color'        => array( '.color-accent', '.color-accent-hover:hover', '.color-accent-hover:focus', '.has-accent-color', '.has-drop-cap:not(:focus):first-letter', '.wp-block-button.is-style-outline', 'a' ),
     620                'border-color' => array( 'blockquote', '.border-color-accent', '.border-color-accent-hover:hover', '.border-color-accent-hover:focus' ),
     621                'background'   => array( 'button:not(.toggle)', '.button', '.faux-button', '.wp-block-button__link', '.wp-block-file .wp-block-file__button', 'input[type="button"]', 'input[type="reset"]', 'input[type="submit"]', '.bg-accent', '.bg-accent-hover:hover', '.bg-accent-hover:focus', '.has-accent-background-color', '.comment-reply-link' ),
     622                'fill'         => array( '.fill-children-accent', '.fill-children-accent *' ),
    630623            ),
    631624            'background' => array(
    632625                'color'      => array( 'button', '.button', '.faux-button', '.wp-block-button__link', '.wp-block-button__link:active', '.wp-block-button__link:focus', '.wp-block-button__link:visited', '.wp-block-button__link:hover', '.wp-block-file__button', 'input[type="button"]', 'input[type="reset"]', 'input[type="submit"]', '.comment-reply-link' ),
    633                 'background' => array(),
     626                'background' => array( '.has-background-background-color' ),
    634627            ),
    635628            'text'       => array(
    636                 'color' => array( 'body', '.entry-title a' ),
     629                'color'      => array( 'body', '.entry-title a', '.has-primary-color' ),
     630                'background' => array( '.has-primary-background-color' ),
    637631            ),
    638632            'secondary'  => array(
    639                 'color' => array( 'cite', 'figcaption', '.wp-caption-text', '.post-meta', '.entry-content .wp-block-archives li', '.entry-content .wp-block-categories li', '.entry-content .wp-block-latest-posts li', '.wp-block-latest-comments__comment-date', '.wp-block-latest-posts__post-date', '.wp-block-embed figcaption', '.wp-block-image figcaption', '.wp-block-pullquote cite', '.comment-metadata', '.comment-respond .comment-notes', '.comment-respond .logged-in-as', '.pagination .dots', '.entry-content hr:not(.has-background)', 'hr.styled-separator' ),
     633                'color'      => array( 'cite', 'figcaption', '.wp-caption-text', '.post-meta', '.entry-content .wp-block-archives li', '.entry-content .wp-block-categories li', '.entry-content .wp-block-latest-posts li', '.wp-block-latest-comments__comment-date', '.wp-block-latest-posts__post-date', '.wp-block-embed figcaption', '.wp-block-image figcaption', '.wp-block-pullquote cite', '.comment-metadata', '.comment-respond .comment-notes', '.comment-respond .logged-in-as', '.pagination .dots', '.entry-content hr:not(.has-background)', 'hr.styled-separator', '.has-secondary-color' ),
     634                'background' => array( '.has-secondary-background-color' ),
    640635            ),
    641636            'borders'    => array(
    642637                'border-color'        => array( 'pre', 'fieldset', 'input', 'textarea', 'table', 'table *', 'hr' ),
    643                 'background'          => array( 'caption', 'code', 'code', 'kbd', 'samp', '.wp-block-table.is-style-stripes tbody tr:nth-child(odd)' ),
     638                'background'          => array( 'caption', 'code', 'code', 'kbd', 'samp', '.wp-block-table.is-style-stripes tbody tr:nth-child(odd)', '.has-subtle-background-background-color' ),
    644639                'border-bottom-color' => array( '.wp-block-table.is-style-stripes' ),
    645640                'border-top-color'    => array( '.wp-block-latest-posts.is-grid li' ),
     641                'color'               => array( '.has-subtle-background-color' ),
    646642            ),
    647643        ),
     
    652648            ),
    653649            'background' => array(
    654                 'color'      => array( '.social-icons a', '.overlay-header .header-inner', '.primary-menu ul', '.header-footer-group button', '.header-footer-group .button', '.header-footer-group .faux-button', '.header-footer-group .wp-block-button:not(.is-style-outline) .wp-block-button__link', '.header-footer-group .wp-block-file__button', '.header-footer-group input[type="button"]', '.header-footer-group input[type="reset"]', '.header-footer-group input[type="submit"]' ),
     650                'color'      => array( '.social-icons a', '.overlay-header .header-inner', 'body:not(.overlay-header) .primary-menu ul', '.header-footer-group button', '.header-footer-group .button', '.header-footer-group .faux-button', '.header-footer-group .wp-block-button:not(.is-style-outline) .wp-block-button__link', '.header-footer-group .wp-block-file__button', '.header-footer-group input[type="button"]', '.header-footer-group input[type="reset"]', '.header-footer-group input[type="submit"]' ),
    655651                'background' => array( '#site-header', '.footer-nav-widgets-wrapper', '#site-footer', '.menu-modal', '.menu-modal-inner', '.search-modal-inner', '.archive-header', '.singular .entry-header', '.singular .featured-media:before', '.wp-block-pullquote:before' ),
    656652            ),
Note: See TracChangeset for help on using the changeset viewer.