Make WordPress Core

Changeset 44298


Ignore:
Timestamp:
12/18/2018 10:08:33 PM ( 6 years ago)
Author:
desrosj
Message:

Twenty Nineteen: Code Quality Improvements.

This change adds general code quality and documentation improvements.

More info here: https://github.com/WordPress/twentynineteen/pull/546

Props grapplerulrich, iCaleb, allancole.

Merges [44187] to trunk.

See #45424 .

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/wp-content/themes/twentynineteen/archive.php

    r44149 r44298  
    twenty-one twenty-one                 <? php
    twenty-two twenty-two                     the_archive_title( '<h1 class="page-title">', '</h1>' );
    twenty-three                       // Remove for now @TODO
    twenty-four                       // the_archive_description( '<div class="page-description">', '</div>' );
    twenty-five twenty-three                 ?>
    twenty-six twenty-four             </header><!-- . page-header -->
  • trunk/src/wp-content/themes/twentynineteen/functions.php

    r44149 r44298  
    two hundred and sixty-four two hundred and sixty-four     require_once get_parent_theme_file_path( '/inc/color-patterns.php' );
    two hundred and sixty-five two hundred and sixty-five
    two hundred and sixty-six       if ( 'default' === get_theme_mod( 'primary_color', 'default' ) ) {
    two hundred and sixty-seven           $primary_color = 199;
    two hundred and sixty-eight       } else {
    two hundred and sixty-nine           $primary_color = absint( get_theme_mod( 'primary_color_hue', 199 ) );
      two hundred and sixty-six     $primary_color = 199;
      two hundred and sixty-seven     if ( 'default' !== get_theme_mod( 'primary_color', 'default' ) ) {
      two hundred and sixty-eight         $primary_color = get_theme_mod( 'primary_color_hue', 199 );
    two hundred and seventy two hundred and sixty-nine     }
    two hundred and seventy-one two hundred and seventy     ?>
    two hundred and seventy-two two hundred and seventy-one
    two hundred and seventy-three       <style type="text/css" id="custom-theme-colors" <? php echo is_customize_preview() ? ' data-hue="' . $primary_color . '"' : ''; ?>>
      two hundred and seventy-two     <style type="text/css" id="custom-theme-colors" <? php echo is_customize_preview() ? ' data-hue="' . absint( $primary_color ) . '"' : ''; ?>>
    two hundred and seventy-four two hundred and seventy-three         <? php echo twentynineteen_custom_colors_css(); ?>
    two hundred and seventy-five two hundred and seventy-four     </style>
  • trunk/src/wp-content/themes/twentynineteen/header.php

    r44149 r44298  
    thirty-two thirty-two             <? php if ( is_singular() && twentynineteen_can_show_post_thumbnail() ) : ?>
    thirty-three thirty-three                 <div class="site-featured-image">
    thirty-four                       <? php twentynineteen_post_thumbnail(); ?>
    thirty-five                       <? php the_post(); ?>
    thirty-six                       <? php $discussion = ! is_page() && twentynineteen_can_show_post_thumbnail() ? twentynineteen_get_discussion_data() : null; ?>
    thirty-seven                       <div class="<?php echo ( ! empty( $discussion ) && count( $discussion->responses ) > 0 ) ? ' entry-header has-discussion' : 'entry-header'; ?>">
      thirty-four                     <? php
      thirty-five                         twentynineteen_post_thumbnail();
      thirty-six                         the_post();
      thirty-seven                         $discussion = ! is_page() && twentynineteen_can_show_post_thumbnail() ? twentynineteen_get_discussion_data() : null;
      thirty-eight
      thirty-nine                         $classes = 'entry-header';
      forty                     if ( ! empty( $discussion ) && count( $discussion->responses ) > 0 ) {
      forty-one                         $classes = 'entry-header has-discussion';
      forty-two                     }
      forty-three                     ?>
      forty-four                     <div class="<?php echo $classes; ?>">
    thirty-eight forty-five                         <? php get_template_part( 'template-parts/header/entry', 'header' ); ?>
    thirty-nine forty-six                     </div><!-- . entry-header -->
  • trunk/src/wp-content/themes/twentynineteen/image.php

    r44155 r44298  
    forty-two forty-two                         ?>
    forty-three forty-three
    forty-four                               <figcaption class="wp-caption-text"><? php echo get_ the_excerpt(); ?></ figcaption>
      forty-four                             <figcaption class="wp-caption-text"><? php the_excerpt(); ?></ figcaption>
    forty-five forty-five
    forty-six forty-six                         </figure><!-- . entry-attachment -->
  • trunk/src/wp-content/themes/twentynineteen/inc/color-patterns.php

    r44155 r44298  
    thirteen thirteen function twentynineteen_custom_colors_css() {
    fourteen fourteen
    fifteen       if ( 'default' === get_theme_mod( 'primary_color', 'default' ) ) {
    sixteen           $primary_color = 199;
    seventeen       } else {
    eighteen           $primary_color = absint( get_theme_mod( 'primary_color_hue', 199 ) );
      fifteen     $primary_color = 199;
      sixteen     if ( 'default' !== get_theme_mod( 'primary_color', 'default' ) ) {
      seventeen         $primary_color = absint( get_theme_mod( 'primary_color', 199 ) );
    nineteen eighteen     }
    twenty nineteen
     
    twenty-six twenty-five      * @param int $saturation Color saturation level.
    twenty-seven twenty-six      */
    twenty-eight  
    twenty-nine       $saturation = absint( apply_filters( 'twentynineteen_custom_colors_saturation', 100 ) );
    thirty       $saturation = $saturation . '%';
    thirty-one  
      twenty-seven     $saturation = apply_filters( 'twentynineteen_custom_colors_saturation', 100 );
      twenty-eight     $saturation = absint( $saturation ) . '%';
      twenty-nine
      thirty     /**
      thirty-one      * Filter Twenty Nineteen default selection saturation level.
      thirty-two      *
      thirty-three      * @since Twenty Nineteen 1.0
      thirty-four      *
      thirty-five      * @param int $saturation_selection Selection color saturation level.
      thirty-six      */
    thirty-two thirty-seven     $saturation_selection = absint( apply_filters( 'twentynineteen_custom_colors_saturation_selection', 50 ) );
    thirty-three thirty-eight     $saturation_selection = $saturation_selection . '%';
    thirty-four thirty-nine
    thirty-five       $lightness = absint( apply_filters( 'twentynineteen_custom_colors_lightness', 33 ) );
    thirty-six       $lightness = $lightness . '%';
    thirty-seven  
    thirty-eight       $lightness_hover = absint( apply_filters( 'twentynineteen_custom_colors_lightness_hover', 23 ) );
    thirty-nine       $lightness_hover = $lightness_hover . '%';
    forty  
    forty-one       $lightness_selection = absint( apply_filters( 'twentynineteen_custom_colors_lightness_selection', 90 ) );
    forty-two       $lightness_selection = $lightness_selection . '%';
      forty     /**
      forty-one      * Filter Twenty Nineteen default lightness level.
      forty-two      *
      forty-three      * @since Twenty Nineteen 1.0
      forty-four      *
      forty-five      * @param int $lightness Color lightness level.
      forty-six      */
      forty-seven     $lightness = apply_filters( 'twentynineteen_custom_colors_lightness', 33 );
      forty-eight     $lightness = absint( $lightness ) . '%';
      forty-nine
      fifty     /**
      fifty-one      * Filter Twenty Nineteen default hover lightness level.
      fifty-two      *
      fifty-three      * @since Twenty Nineteen 1.0
      fifty-four      *
      fifty-five      * @param int $lightness_hover Hover color lightness level.
      fifty-six      */
      fifty-seven     $lightness_hover = apply_filters( 'twentynineteen_custom_colors_lightness_hover', 23 );
      fifty-eight     $lightness_hover = absint( $lightness_hover ) . '%';
      fifty-nine
      sixty     /**
      sixty-one      * Filter Twenty Nineteen default selection lightness level.
      sixty-two      *
      sixty-three      * @since Twenty Nineteen 1.0
      sixty-four      *
      sixty-five      * @param int $lightness_selection Selection color lightness level.
      sixty-six      */
      sixty-seven     $lightness_selection = apply_filters( 'twentynineteen_custom_colors_lightness_selection', 90 );
      sixty-eight     $lightness_selection = absint( $lightness_selection ) . '%';
    forty-three sixty-nine
    forty-four seventy     $theme_css = '
     
    two hundred and thirty-four two hundred and sixty         }
    two hundred and thirty-five two hundred and sixty-one         ';
    two hundred and thirty-six       $css        = '';
      two hundred and sixty-two
    two hundred and thirty-seven two hundred and sixty-three     if ( function_exists( 'register_block_type' ) && is_admin() ) {
    two hundred and thirty-eight           $css .= $ editor_css;
    two hundred and thirty-nine       } elseif ( ! is_admin() ) {
    two hundred and forty           $css = $theme_css;
      two hundred and sixty-four         $theme_css = $editor_css;
    two hundred and forty-one two hundred and sixty-five     }
    two hundred and forty-two two hundred and sixty-six
     
    two hundred and fifty two hundred and seventy-four      * @param string $saturation    Filtered theme color saturation level.
    two hundred and fifty-one two hundred and seventy-five      */
    two hundred and fifty-two       return apply_filters( 'twentynineteen_custom_colors_css', $ css, $primary_color, $saturation );
      two hundred and seventy-six     return apply_filters( 'twentynineteen_custom_colors_css', $ theme_ css, $primary_color, $saturation );
    two hundred and fifty-three two hundred and seventy-seven }
  • trunk/src/wp-content/themes/twentynineteen/inc/customizer.php

    r44155 r44298  
    one hundred and twenty-six one hundred and twenty-six  */
    one hundred and twenty-seven one hundred and twenty-seven function twentynineteen_customize_preview_js() {
    one hundred and twenty-eight       wp_enqueue_script( 'twentynineteen-customize-preview', get_theme_file_uri( '/js/customize-preview.js' ), array( 'customize-preview' ), '201 fifty-one thousand two hundred and fifteen ', true );
      one hundred and twenty-eight     wp_enqueue_script( 'twentynineteen-customize-preview', get_theme_file_uri( '/js/customize-preview.js' ), array( 'customize-preview' ), '201 eighty-one thousand one hundred and eight ', true );
    one hundred and twenty-nine one hundred and twenty-nine }
    one hundred and thirty one hundred and thirty add_action( 'customize_preview_init', 'twentynineteen_customize_preview_js' );
     
    one hundred and thirty-four one hundred and thirty-four  */
    one hundred and thirty-five one hundred and thirty-five function twentynineteen_panels_js() {
    one hundred and thirty-six       wp_enqueue_script( 'twentynineteen-customize-controls', get_theme_file_uri( '/js/customize-controls.js' ), array(), ' one ', true );
      one hundred and thirty-six     wp_enqueue_script( 'twentynineteen-customize-controls', get_theme_file_uri( '/js/customize-controls.js' ), array(), ' twenty million one hundred and eighty-one thousand and thirty-one ', true );
    one hundred and thirty-seven one hundred and thirty-seven }
    one hundred and thirty-eight one hundred and thirty-eight add_action( 'customize_controls_enqueue_scripts', 'twentynineteen_panels_js' );
  • trunk/src/wp-content/themes/twentynineteen/inc/template-functions.php

    r44155 r44298  
    one hundred and seven one hundred and seven  */
    one hundred and eight one hundred and eight function twentynineteen_image_filters_enabled() {
    one hundred and nine       if ( get_theme_mod( 'image_filter', 1 ) ) {
    one hundred and ten           return true;
    one hundred and eleven       }
    one hundred and twelve       return false;
      one hundred and nine     return 'inactive' !== get_theme_mod( 'image_filter', 1 );
    one hundred and thirteen one hundred and ten }
    one hundred and fourteen one hundred and eleven
     
    four hundred and nineteen four hundred and sixteen         return "#$r$g$b";
    four hundred and twenty four hundred and seventeen
    four hundred and twenty-one       } else {
    four hundred and twenty-two  
    four hundred and twenty-three           return "rgb($r, $g, $b)";
    four hundred and twenty-four       }
    four hundred and twenty-five   }
      four hundred and eighteen     }
      four hundred and nineteen
      four hundred and twenty     return "rgb($r, $g, $b)";
      four hundred and twenty-one }
  • trunk/src/wp-content/themes/twentynineteen/inc/template-tags.php

    r44155 r44298  
    one hundred and fifty-eight one hundred and fifty-eight         <figure class="post-thumbnail">
    one hundred and fifty-nine one hundred and fifty-nine             <a class="post-thumbnail-inner" href="<?php the_permalink(); ?> " aria-hidden="true" tabindex="-1">
    one hundred and sixty                   <? php
    one hundred and sixty-one                   the_post_thumbnail( 'post-thumbnail' );
    one hundred and sixty-two                   ?>
      one hundred and sixty                 <? php the_post_thumbnail( 'post-thumbnail' ); ?>
    one hundred and sixty-three one hundred and sixty-one             </a>
    one hundred and sixty-four one hundred and sixty-two         </figure>
     
    two hundred and twenty-four two hundred and twenty-two      */
    two hundred and twenty-five two hundred and twenty-three     function twentynineteen_the_posts_navigation() {
    two hundred and twenty-six           $prev_icon = twentynineteen_get_icon_svg( 'chevron_left', 22 );
    two hundred and twenty-seven           $next_icon = twentynineteen_get_icon_svg( 'chevron_right', 22 );
    two hundred and twenty-eight two hundred and twenty-four         the_posts_pagination(
    two hundred and twenty-nine two hundred and twenty-five             array(
    two hundred and thirty two hundred and twenty-six                 'mid_size'  => 2,
    two hundred and thirty-one                   'prev_text' => sprintf( '%s <span class="nav-prev-text">%s</span>', $prev_icon, __( 'Newer posts', 'twentynineteen' ) ),
    two hundred and thirty-two                   'next_text' => sprintf( '<span class="nav-next-text">%s</span> %s', __( 'Older posts', 'twentynineteen' ), $next_icon ),
      two hundred and twenty-seven                 'prev_text' => sprintf(
      two hundred and twenty-eight                     '%s <span class="nav-prev-text">%s</span>',
      two hundred and twenty-nine                     twentynineteen_get_icon_svg( 'chevron_left', 22 ),
      two hundred and thirty                     __( 'Newer posts', 'twentynineteen' )
      two hundred and thirty-one                 ),
      two hundred and thirty-two                 'next_text' => sprintf(
      two hundred and thirty-three                     '<span class="nav-next-text">%s</span> %s',
      two hundred and thirty-four                     __( 'Older posts', 'twentynineteen' ),
      two hundred and thirty-five                     twentynineteen_get_icon_svg( 'chevron_right', 22 )
      two hundred and thirty-six                 ),
    two hundred and thirty-three two hundred and thirty-seven             )
    two hundred and thirty-four two hundred and thirty-eight         );
  • trunk/src/wp-content/themes/twentynineteen/index.php

    r44149 r44298  
    forty forty         }
    forty-one forty-one         ?>
    forty-two          
      forty-two
    forty-three forty-three         </main><!-- . site-main -->
    forty-four forty-four     </section><!-- . content-area -->
  • trunk/src/wp-content/themes/twentynineteen/sass/navigation/_menu-social-navigation.scss

    r44149 r44298  
    forty-six forty-six                     height: 32px;
    forty-seven forty-seven
      forty-eight                     // Prevent icons from jumping in Safari using hardware acceleration.
      forty-nine                     transform: translateZ(0);
      fifty
    forty-eight fifty-one                     &#ui-icon-link {
    forty-nine fifty-two                         transform: rotate(-45deg);
  • trunk/src/wp-content/themes/twentynineteen/style-rtl.css

    r44149 r44298  
    one thousand six hundred and five one thousand six hundred and five   width: 32px;
    one thousand six hundred and six one thousand six hundred and six   height: 32px;
      one thousand six hundred and seven   transform: translateZ(0);
    one thousand six hundred and seven one thousand six hundred and eight }
    one thousand six hundred and eight one thousand six hundred and nine
  • trunk/src/wp-content/themes/twentynineteen/style.css

    r44149 r44298  
    one thousand six hundred and five one thousand six hundred and five   width: 32px;
    one thousand six hundred and six one thousand six hundred and six   height: 32px;
      one thousand six hundred and seven   transform: translateZ(0);
    one thousand six hundred and seven one thousand six hundred and eight }
    one thousand six hundred and eight one thousand six hundred and nine
Note: See TracChangeset for help on using the changeset viewer.