WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/30/2018 02:13:07 AM (3 years ago)
Author:
allancole
Message:

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

Let Gutenberg shine with this simple, fast, and powerful theme. 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.

File:
1 edited

Legend:

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

    r43808 r43842  
    77 * @package WordPress
    88 * @subpackage Twenty_Nineteen
     9 * @since 1.0.0
    910 */
    1011
     
    6869        );
    6970
    70         // Set up the WordPress core custom background feature.
    71         add_theme_support(
    72             'custom-background',
    73             apply_filters(
    74                 'twentynineteen_custom_background_args',
    75                 array(
    76                     'default-color' => 'ffffff',
    77                     'default-image' => '',
    78                 )
    79             )
    80         );
    81 
    8271        /**
    8372         * Add support for core custom logo.
     
    10796        add_editor_style( 'style-editor.css' );
    10897
     98        // Add custom color to the editor color palette
     99        add_theme_support(
     100        'editor-color-palette',
     101            array(
     102                array(
     103                    'name'  => esc_html__( 'Primary Color', 'twentynineteen' ),
     104                    'slug'  => 'primary',
     105                    'color' => twentynineteen_hsl_hex( absint( get_theme_mod( 'colorscheme_hue', 199 ) ), 100, 33 ),
     106                ),
     107            )
     108        );
     109
    109110    }
    110111endif;
    111112add_action( 'after_setup_theme', 'twentynineteen_setup' );
     113
     114/**
     115 * Register widget area.
     116 *
     117 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
     118 */
     119function twentynineteen_widgets_init() {
     120
     121    register_sidebar(
     122        array(
     123            'name'          => __( 'Footer 1', 'twentynineteen' ),
     124            'id'            => 'sidebar-1',
     125            'description'   => __( 'Add widgets here to appear in your footer.', 'twentynineteen' ),
     126            'before_widget' => '<section id="%1$s" class="widget %2$s">',
     127            'after_widget'  => '</section>',
     128            'before_title'  => '<h2 class="widget-title">',
     129            'after_title'   => '</h2>',
     130        )
     131    );
     132
     133}
     134add_action( 'widgets_init', 'twentynineteen_widgets_init' );
    112135
    113136/**
     
    136159    wp_enqueue_script( 'twentynineteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );
    137160
     161    if ( has_nav_menu( 'menu-1' ) ) {
     162        wp_enqueue_script( 'twentynineteen-touch-navigation', get_theme_file_uri( '/js/touch-navigation.js' ), array(), '1.0', true );
     163        $twentynineteen_l10n['expand']   = __( 'Expand child menu', 'twentynineteen' );
     164        $twentynineteen_l10n['collapse'] = __( 'Collapse child menu', 'twentynineteen' );
     165    }
     166
     167    wp_localize_script( 'twentynineteen-skip-link-focus-fix', 'twentynineteenScreenReaderText', $twentynineteen_l10n );
     168
    138169    wp_enqueue_style( 'twentynineteen-print-style', get_template_directory_uri() . '/print.css', array(), wp_get_theme()->get( 'Version' ), 'print' );
    139170
     
    152183 */
    153184function twentynineteen_editor_frame_styles() {
     185
     186    // Include color patterns
     187    require_once( get_parent_theme_file_path( '/inc/color-patterns.php' ) );
     188
    154189    wp_enqueue_style( 'twentynineteen-editor-frame-styles', get_theme_file_uri( '/style-editor-frame.css' ), false, '1.0', 'all' );
    155 }
    156 
     190    wp_add_inline_style( 'twentynineteen-editor-frame-styles', twentynineteen_custom_colors_css() );
     191}
    157192add_action( 'enqueue_block_editor_assets', 'twentynineteen_editor_frame_styles' );
    158193
    159194/**
     195 * Display custom color CSS in customizer and on frontend.
     196 */
     197function twentynineteen_colors_css_wrap() {
     198    if ( 'custom' !== get_theme_mod( 'colorscheme' ) && ! is_customize_preview() ) {
     199        return;
     200    }
     201
     202    require_once( get_parent_theme_file_path( '/inc/color-patterns.php' ) );
     203    $hue = absint( get_theme_mod( 'colorscheme_hue', 250 ) );
     204    ?>
     205
     206    <style type="text/css" id="custom-theme-colors" <?php echo is_customize_preview() ? 'data-hue="' . $hue . '"' : ''; ?>>
     207        <?php echo twentynineteen_custom_colors_css(); ?>
     208    </style>
     209<?php
     210}
     211add_action( 'wp_head', 'twentynineteen_colors_css_wrap' );
     212
     213/**
    160214 * SVG Icons class.
    161215 */
Note: See TracChangeset for help on using the changeset viewer.