Make WordPress Core

Changeset 44187


Ignore:
Timestamp:
12/14/2018 07:08:06 PM (6 years ago)
Author:
allancole
Message:

Updating Twenty Nineteen, the new default theme for 2019.

This change adds general code quality and documentation improvements.

Props grapplerulrich, iCaleb.

Location:
branches/5.0/src/wp-content/themes/twentynineteen
Files:
13 edited

Legend:

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

    r43892 r44187  
    2121                <?php
    2222                    the_archive_title( '<h1 class="page-title">', '</h1>' );
    23                     // Remove for now @TODO
    24                     // the_archive_description( '<div class="page-description">', '</div>' );
    2523                ?>
    2624            </header><!-- .page-header -->
  • branches/5.0/src/wp-content/themes/twentynineteen/classes/class-twentynineteen-svg-icons.php

    r43892 r44187  
    206206            'fb.me',
    207207        ),
    208         'feed'    => array(
     208        'feed'        => array(
    209209            'feed',
    210210        ),
     
    212212            'plus.google.com',
    213213        ),
    214         'lastfm'   => array(
     214        'lastfm'      => array(
    215215            'last.fm',
    216216        ),
    217         'mail'   => array(
     217        'mail'        => array(
    218218            'mailto:',
    219219        ),
  • branches/5.0/src/wp-content/themes/twentynineteen/functions.php

    r43929 r44187  
    264264    require_once get_parent_theme_file_path( '/inc/color-patterns.php' );
    265265
    266     if ( 'default' === get_theme_mod( 'primary_color', 'default' ) ) {
    267         $primary_color = 199;
    268     } else {
    269         $primary_color = absint( get_theme_mod( 'primary_color_hue', 199 ) );
     266    $primary_color = 199;
     267    if ( 'default' !== get_theme_mod( 'primary_color', 'default' ) ) {
     268        $primary_color = get_theme_mod( 'primary_color_hue', 199 );
    270269    }
    271270    ?>
    272271
    273     <style type="text/css" id="custom-theme-colors" <?php echo is_customize_preview() ? 'data-hue="' . $primary_color . '"' : ''; ?>>
     272    <style type="text/css" id="custom-theme-colors" <?php echo is_customize_preview() ? 'data-hue="' . absint( $primary_color ) . '"' : ''; ?>>
    274273        <?php echo twentynineteen_custom_colors_css(); ?>
    275274    </style>
  • branches/5.0/src/wp-content/themes/twentynineteen/header.php

    r43892 r44187  
    3232            <?php if ( is_singular() && twentynineteen_can_show_post_thumbnail() ) : ?>
    3333                <div class="site-featured-image">
    34                     <?php twentynineteen_post_thumbnail(); ?>
    35                     <?php the_post(); ?>
    36                     <?php $discussion = ! is_page() && twentynineteen_can_show_post_thumbnail() ? twentynineteen_get_discussion_data() : null; ?>
    37                     <div class="<?php echo ( ! empty( $discussion ) && count( $discussion->responses ) > 0 ) ? 'entry-header has-discussion' : 'entry-header'; ?>">
     34                    <?php
     35                        twentynineteen_post_thumbnail();
     36                        the_post();
     37                        $discussion = ! is_page() && twentynineteen_can_show_post_thumbnail() ? twentynineteen_get_discussion_data() : null;
     38
     39                        $classes = 'entry-header';
     40                        if ( ! empty( $discussion ) && count( $discussion->responses ) > 0 ) {
     41                            $classes = 'entry-header has-discussion';
     42                        }
     43                    ?>
     44                    <div class="<?php echo $classes; ?>">
    3845                        <?php get_template_part( 'template-parts/header/entry', 'header' ); ?>
    3946                    </div><!-- .entry-header -->
  • branches/5.0/src/wp-content/themes/twentynineteen/image.php

    r43892 r44187  
    4242                            ?>
    4343
    44                             <figcaption class="wp-caption-text"><?php echo get_the_excerpt(); ?></figcaption>
     44                            <figcaption class="wp-caption-text"><?php the_excerpt(); ?></figcaption>
    4545
    4646                        </figure><!-- .entry-attachment -->
  • branches/5.0/src/wp-content/themes/twentynineteen/inc/color-patterns.php

    r43909 r44187  
    1313function twentynineteen_custom_colors_css() {
    1414
    15     if ( 'default' === get_theme_mod( 'primary_color', 'default' ) ) {
    16         $primary_color = 199;
    17     } else {
    18         $primary_color = absint( get_theme_mod( 'primary_color_hue', 199 ) );
     15    $primary_color = 199;
     16    if ( 'default' !== get_theme_mod( 'primary_color', 'default' ) ) {
     17        $primary_color = absint( get_theme_mod( 'primary_color', 199 ) );
    1918    }
    2019
     
    2625     * @param int $saturation Color saturation level.
    2726     */
    28 
    29     $saturation           = absint( apply_filters( 'twentynineteen_custom_colors_saturation', 100 ) );
    30     $saturation           = $saturation . '%';
    31 
     27    $saturation = apply_filters( 'twentynineteen_custom_colors_saturation', 100 );
     28    $saturation = absint( $saturation ) . '%';
     29
     30    /**
     31     * Filter Twenty Nineteen default selection saturation level.
     32     *
     33     * @since Twenty Nineteen 1.0
     34     *
     35     * @param int $saturation_selection Selection color saturation level.
     36     */
    3237    $saturation_selection = absint( apply_filters( 'twentynineteen_custom_colors_saturation_selection', 50 ) );
    3338    $saturation_selection = $saturation_selection . '%';
    3439
    35     $lightness            = absint( apply_filters( 'twentynineteen_custom_colors_lightness', 33 ) );
    36     $lightness            = $lightness . '%';
    37 
    38     $lightness_hover      = absint( apply_filters( 'twentynineteen_custom_colors_lightness_hover', 23 ) );
    39     $lightness_hover      = $lightness_hover . '%';
    40 
    41     $lightness_selection  = absint( apply_filters( 'twentynineteen_custom_colors_lightness_selection', 90 ) );
    42     $lightness_selection  = $lightness_selection . '%';
     40    /**
     41     * Filter Twenty Nineteen default lightness level.
     42     *
     43     * @since Twenty Nineteen 1.0
     44     *
     45     * @param int $lightness Color lightness level.
     46     */
     47    $lightness = apply_filters( 'twentynineteen_custom_colors_lightness', 33 );
     48    $lightness = absint( $lightness ) . '%';
     49
     50    /**
     51     * Filter Twenty Nineteen default hover lightness level.
     52     *
     53     * @since Twenty Nineteen 1.0
     54     *
     55     * @param int $lightness_hover Hover color lightness level.
     56     */
     57    $lightness_hover = apply_filters( 'twentynineteen_custom_colors_lightness_hover', 23 );
     58    $lightness_hover = absint( $lightness_hover ) . '%';
     59
     60    /**
     61     * Filter Twenty Nineteen default selection lightness level.
     62     *
     63     * @since Twenty Nineteen 1.0
     64     *
     65     * @param int $lightness_selection Selection color lightness level.
     66     */
     67    $lightness_selection = apply_filters( 'twentynineteen_custom_colors_lightness_selection', 90 );
     68    $lightness_selection = absint( $lightness_selection ) . '%';
    4369
    4470    $theme_css = '
     
    234260        }
    235261        ';
    236     $css = '';
     262
    237263    if ( function_exists( 'register_block_type' ) && is_admin() ) {
    238         $css .= $editor_css;
    239     } else if ( ! is_admin() ) {
    240         $css = $theme_css;
     264        $theme_css = $editor_css;
    241265    }
    242266
     
    250274     * @param string $saturation    Filtered theme color saturation level.
    251275     */
    252     return apply_filters( 'twentynineteen_custom_colors_css', $css, $primary_color, $saturation );
     276    return apply_filters( 'twentynineteen_custom_colors_css', $theme_css, $primary_color, $saturation );
    253277}
  • branches/5.0/src/wp-content/themes/twentynineteen/inc/customizer.php

    r43909 r44187  
    126126 */
    127127function twentynineteen_customize_preview_js() {
    128     wp_enqueue_script( 'twentynineteen-customize-preview', get_theme_file_uri( '/js/customize-preview.js' ), array( 'customize-preview' ), '20151215', true );
     128    wp_enqueue_script( 'twentynineteen-customize-preview', get_theme_file_uri( '/js/customize-preview.js' ), array( 'customize-preview' ), '20181108', true );
    129129}
    130130add_action( 'customize_preview_init', 'twentynineteen_customize_preview_js' );
     
    134134 */
    135135function twentynineteen_panels_js() {
    136     wp_enqueue_script( 'twentynineteen-customize-controls', get_theme_file_uri( '/js/customize-controls.js' ), array(), '1.0', true );
     136    wp_enqueue_script( 'twentynineteen-customize-controls', get_theme_file_uri( '/js/customize-controls.js' ), array(), '20181031', true );
    137137}
    138138add_action( 'customize_controls_enqueue_scripts', 'twentynineteen_panels_js' );
  • branches/5.0/src/wp-content/themes/twentynineteen/inc/template-functions.php

    r43909 r44187  
    107107 */
    108108function twentynineteen_image_filters_enabled() {
    109     if ( get_theme_mod( 'image_filter', 1 ) ) {
    110         return true;
    111     }
    112     return false;
     109    return 'inactive' !== get_theme_mod( 'image_filter', 1 );
    113110}
    114111
     
    419416        return "#$r$g$b";
    420417
    421     } else {
    422 
    423         return "rgb($r, $g, $b)";
    424     }
    425 }
     418    }
     419
     420    return "rgb($r, $g, $b)";
     421}
  • branches/5.0/src/wp-content/themes/twentynineteen/inc/template-tags.php

    r43892 r44187  
    158158        <figure class="post-thumbnail">
    159159            <a class="post-thumbnail-inner" href="<?php the_permalink(); ?>" aria-hidden="true" tabindex="-1">
    160                 <?php
    161                 the_post_thumbnail( 'post-thumbnail' );
    162                 ?>
     160                <?php the_post_thumbnail( 'post-thumbnail' ); ?>
    163161            </a>
    164162        </figure>
     
    211209            comment_form(
    212210                array(
    213                     'logged_in_as'       => null,
    214                     'title_reply'        => null,
     211                    'logged_in_as' => null,
     212                    'title_reply'  => null,
    215213                )
    216214            );
     
    224222     */
    225223    function twentynineteen_the_posts_navigation() {
    226         $prev_icon = twentynineteen_get_icon_svg( 'chevron_left', 22 );
    227         $next_icon = twentynineteen_get_icon_svg( 'chevron_right', 22 );
    228224        the_posts_pagination(
    229225            array(
    230226                'mid_size'  => 2,
    231                 'prev_text' => sprintf( '%s <span class="nav-prev-text">%s</span>', $prev_icon, __( 'Newer posts', 'twentynineteen' ) ),
    232                 'next_text' => sprintf( '<span class="nav-next-text">%s</span> %s', __( 'Older posts', 'twentynineteen' ), $next_icon ),
     227                'prev_text' => sprintf(
     228                    '%s <span class="nav-prev-text">%s</span>',
     229                    twentynineteen_get_icon_svg( 'chevron_left', 22 ),
     230                    __( 'Newer posts', 'twentynineteen' )
     231                ),
     232                'next_text' => sprintf(
     233                    '<span class="nav-next-text">%s</span> %s',
     234                    __( 'Older posts', 'twentynineteen' ),
     235                    twentynineteen_get_icon_svg( 'chevron_right', 22 )
     236                ),
    233237            )
    234238        );
  • branches/5.0/src/wp-content/themes/twentynineteen/index.php

    r43892 r44187  
    4040        }
    4141        ?>
    42        
     42
    4343        </main><!-- .site-main -->
    4444    </section><!-- .content-area -->
  • branches/5.0/src/wp-content/themes/twentynineteen/sass/navigation/_menu-social-navigation.scss

    r43927 r44187  
    4646                    height: 32px;
    4747
     48                    // Prevent icons from jumping in Safari using hardware acceleration.
     49                    transform: translateZ(0);
     50
    4851                    &#ui-icon-link {
    4952                        transform: rotate(-45deg);
  • branches/5.0/src/wp-content/themes/twentynineteen/style-rtl.css

    r43961 r44187  
    16051605  width: 32px;
    16061606  height: 32px;
     1607  transform: translateZ(0);
    16071608}
    16081609
  • branches/5.0/src/wp-content/themes/twentynineteen/style.css

    r43961 r44187  
    16051605  width: 32px;
    16061606  height: 32px;
     1607  transform: translateZ(0);
    16071608}
    16081609
Note: See TracChangeset for help on using the changeset viewer.