Make WordPress Core


Ignore:
Timestamp:
11/12/2018 11:19:13 PM (6 years ago)
Author:
allancole
Message:

Updating Twenty Nineteen, our new default theme for 2019, set for 5.0.

This update applies the following changes:

  • Improve menu UI to support keyboard, click and touch interactions
  • Improve variable scoping and js performance in menu interaction javascript
  • Improve custom-colors for selected text, buttons and menu hover styles
  • Improve margins structure for more consistency between editor and frontend
  • Improve discussion avatars for simpler wording and better performance
  • Improve fonts in list widgets and list blocks
  • Improve comment responsive spacing and avatar display
  • Improve various block styles to make them consistent between the editor and frontend
  • Add tabbed browsing support for ie11
  • Add backwards compatibility support for older versions of WordPress
  • Add fallback styles for older versions of WP where Gutenberg is activated and then deactivated (backwards compatibility)
  • Add sizes attribute for featured images to improve responsive performance
  • Add focus-within polyfill
  • Add a footer menu for secondary page links
  • Fix editor styles to prevent conflicts with plugins that add meta boxes to the editor
  • Fix columns block issues on small screens
  • Fix empty-space font text cursor issue in Gutenberg editor
  • Fix RTL floating styles so that left/right floats are honored
  • Fix cover image block margins/padding
  • Fix invalid rgba style
  • Fix php warning when returning attributes
  • Fix gallery widget margins to improve gallery grids
  • Fix .entry-content selectors to prevent shortcodes, plugins and other unknown content from breaking the layout
  • Remove translation escaping to follow code standards in previous default themes
  • Remove custom color output in the fronten header when default color is selected
  • Remove fly-out sub-sub-sub-menu behavior on desktop to prevent sub-menus from falling off the screen
  • General code clean up and coding standards improvements

Initial development occurred on GitHub. See: https://github.com/WordPress/twentynineteen

Props allancole, karmatosed, kjellr, yingling017, mrasharirfan, milana_cap, fabiankaegy, westonruter, aaronjorbin, netweb, b-07, khleomix, blowery, dereksmart, jasmussen, audrasjb, nielslange, mmaumio, dimadin, joyously, anevins12, peterwilsoncc, dannycooper, icaleb, siriokun, technosiren, travel_girl, azchughtai, ianbelanger, nadim1992, ismailelkorchi, nativeinside, chetan200891, icaleb, grapplerulrich, ocean90, joshfeck, frankew, abdulwahab610, mendezcode, eliorivero, melchoyce, joen, laurelfulford, mdawaffe, kraftbj, dsmart, mukeshpanchal27, burhandodhy, crunnells, Ismail-elkorchi, aryaprakasa, @tlxo, @themeroots, @whizbangik, @yingles, @youthkee, @brentswisher, @smy315, @ahmadawais, @desi-developer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0/src/wp-content/themes/twentynineteen/functions.php

    r43860 r43892  
    99 * @since 1.0.0
    1010 */
     11
     12/**
     13 * Twenty Nineteen only works in WordPress 4.7 or later.
     14 */
     15if ( version_compare( $GLOBALS['wp_version'], '4.7', '<' ) ) {
     16    require get_template_directory() . '/inc/back-compat.php';
     17    return;
     18}
    1119
    1220if ( ! function_exists( 'twentynineteen_setup' ) ) :
     
    4957        register_nav_menus(
    5058            array(
    51                 'menu-1' => esc_html__( 'Primary', 'twentynineteen' ),
     59                'menu-1' => __( 'Primary', 'twentynineteen' ),
     60                'footer' => __( 'Footer Menu', 'twentynineteen' ),
    5261                'social' => __( 'Social Links Menu', 'twentynineteen' ),
    5362            )
     
    8796        add_theme_support( 'customize-selective-refresh-widgets' );
    8897
    89         // Add support for Block Styles
     98        // Add support for Block Styles.
    9099        add_theme_support( 'wp-block-styles' );
    91100
     
    93102        add_theme_support( 'align-wide' );
    94103
    95         // Add support for editor styles
     104        // Add support for editor styles.
    96105        add_theme_support( 'editor-styles' );
    97106
    98         // Enqueue editor styles
     107        // Enqueue editor styles.
    99108        add_editor_style( 'style-editor.css' );
    100109
    101         // Editor color palette
     110        // Editor color palette.
    102111        add_theme_support(
    103112            'editor-color-palette',
    104113            array(
    105114                array(
    106                     'name'  => esc_html__( 'Primary Color', 'twentynineteen' ),
     115                    'name'  => __( 'Primary Color', 'twentynineteen' ),
    107116                    'slug'  => 'primary',
    108117                    'color' => twentynineteen_hsl_hex( 'default' === get_theme_mod( 'colorscheme' ) ? 199 : get_theme_mod( 'colorscheme_primary_hue', 199 ), 100, 33 ),
     
    111120        );
    112121
    113         // Add support for responsive embedded content
     122        // Add support for responsive embedded content.
    114123        add_theme_support( 'responsive-embeds' );
    115124
     
    145154 * Priority 0 to make it available to lower priority callbacks.
    146155 *
    147  * @global int $content_width
     156 * @global int $content_width Content width.
    148157 */
    149158function twentynineteen_content_width() {
     
    166175
    167176    if ( has_nav_menu( 'menu-1' ) ) {
    168         wp_enqueue_script( 'twentynineteen-touch-navigation', get_theme_file_uri( '/js/touch-navigation.js' ), array(), '1.0', true );
    169         $l10n_skip_link_focus_fix['expand']   = __( 'Expand child menu', 'twentynineteen' );
    170         $l10n_skip_link_focus_fix['collapse'] = __( 'Collapse child menu', 'twentynineteen' );
    171         wp_localize_script( 'twentynineteen-skip-link-focus-fix', 'twentynineteenScreenReaderText', $l10n_skip_link_focus_fix );
     177        wp_enqueue_script( 'twentynineteen-priority-menu', get_theme_file_uri( '/js/priority-menu.js' ), array(), '1.0', true );
     178        wp_enqueue_script( 'twentynineteen-touch-navigation', get_theme_file_uri( '/js/touch-keyboard-navigation.js' ), array(), '1.0', true );
    172179    }
    173180
    174181    wp_enqueue_style( 'twentynineteen-print-style', get_template_directory_uri() . '/print.css', array(), wp_get_theme()->get( 'Version' ), 'print' );
    175 
    176     if ( is_singular() && twentynineteen_can_show_post_thumbnail() ) {
    177         wp_add_inline_style( 'twentynineteen-style', twentynineteen_header_featured_image_css() );
    178     }
    179182
    180183    if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
     
    185188
    186189/**
    187  * Enqueue supplemental block editor styles
     190 * Enqueue supplemental block editor styles.
    188191 */
    189192function twentynineteen_editor_customizer_styles() {
     
    193196    if ( 'custom' === get_theme_mod( 'colorscheme' ) ) {
    194197        // Include color patterns
    195         require_once( get_parent_theme_file_path( '/inc/color-patterns.php' ) );
     198        require_once get_parent_theme_file_path( '/inc/color-patterns.php' );
    196199        wp_add_inline_style( 'twentynineteen-editor-customizer-styles', twentynineteen_custom_colors_css() );
    197200    }
     
    204207function twentynineteen_colors_css_wrap() {
    205208
    206     // Only include custom colors in customizer or frontend
    207     if ( ( ! is_customize_preview() && is_admin() ) || is_admin() ) {
     209    // Only include custom colors in customizer or frontend.
     210    if ( ( ! is_customize_preview() && 'default' === get_theme_mod( 'colorscheme', 'default' ) ) || is_admin() ) {
    208211        return;
    209212    }
    210213
    211     require_once( get_parent_theme_file_path( '/inc/color-patterns.php' ) );
     214    require_once get_parent_theme_file_path( '/inc/color-patterns.php' );
    212215
    213216    if ( 'default' === get_theme_mod( 'colorscheme', 'default' ) ) {
     
    221224        <?php echo twentynineteen_custom_colors_css(); ?>
    222225    </style>
    223 <?php
     226    <?php
    224227}
    225228add_action( 'wp_head', 'twentynineteen_colors_css_wrap' );
Note: See TracChangeset for help on using the changeset viewer.