mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
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. Built from https://develop.svn.wordpress.org/trunk@44298 git-svn-id: http://core.svn.wordpress.org/trunk@44128 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5a30da57c6
commit
110aae8048
@ -20,8 +20,6 @@ get_header();
|
|||||||
<header class="page-header">
|
<header class="page-header">
|
||||||
<?php
|
<?php
|
||||||
the_archive_title( '<h1 class="page-title">', '</h1>' );
|
the_archive_title( '<h1 class="page-title">', '</h1>' );
|
||||||
// Remove for now @TODO
|
|
||||||
// the_archive_description( '<div class="page-description">', '</div>' );
|
|
||||||
?>
|
?>
|
||||||
</header><!-- .page-header -->
|
</header><!-- .page-header -->
|
||||||
|
|
||||||
|
@ -263,14 +263,13 @@ function twentynineteen_colors_css_wrap() {
|
|||||||
|
|
||||||
require_once get_parent_theme_file_path( '/inc/color-patterns.php' );
|
require_once get_parent_theme_file_path( '/inc/color-patterns.php' );
|
||||||
|
|
||||||
if ( 'default' === get_theme_mod( 'primary_color', 'default' ) ) {
|
$primary_color = 199;
|
||||||
$primary_color = 199;
|
if ( 'default' !== get_theme_mod( 'primary_color', 'default' ) ) {
|
||||||
} else {
|
$primary_color = get_theme_mod( 'primary_color_hue', 199 );
|
||||||
$primary_color = absint( get_theme_mod( 'primary_color_hue', 199 ) );
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<style type="text/css" id="custom-theme-colors" <?php echo is_customize_preview() ? 'data-hue="' . $primary_color . '"' : ''; ?>>
|
<style type="text/css" id="custom-theme-colors" <?php echo is_customize_preview() ? 'data-hue="' . absint( $primary_color ) . '"' : ''; ?>>
|
||||||
<?php echo twentynineteen_custom_colors_css(); ?>
|
<?php echo twentynineteen_custom_colors_css(); ?>
|
||||||
</style>
|
</style>
|
||||||
<?php
|
<?php
|
||||||
|
@ -31,10 +31,17 @@
|
|||||||
|
|
||||||
<?php if ( is_singular() && twentynineteen_can_show_post_thumbnail() ) : ?>
|
<?php if ( is_singular() && twentynineteen_can_show_post_thumbnail() ) : ?>
|
||||||
<div class="site-featured-image">
|
<div class="site-featured-image">
|
||||||
<?php twentynineteen_post_thumbnail(); ?>
|
<?php
|
||||||
<?php the_post(); ?>
|
twentynineteen_post_thumbnail();
|
||||||
<?php $discussion = ! is_page() && twentynineteen_can_show_post_thumbnail() ? twentynineteen_get_discussion_data() : null; ?>
|
the_post();
|
||||||
<div class="<?php echo ( ! empty( $discussion ) && count( $discussion->responses ) > 0 ) ? 'entry-header has-discussion' : 'entry-header'; ?>">
|
$discussion = ! is_page() && twentynineteen_can_show_post_thumbnail() ? twentynineteen_get_discussion_data() : null;
|
||||||
|
|
||||||
|
$classes = 'entry-header';
|
||||||
|
if ( ! empty( $discussion ) && count( $discussion->responses ) > 0 ) {
|
||||||
|
$classes = 'entry-header has-discussion';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div class="<?php echo $classes; ?>">
|
||||||
<?php get_template_part( 'template-parts/header/entry', 'header' ); ?>
|
<?php get_template_part( 'template-parts/header/entry', 'header' ); ?>
|
||||||
</div><!-- .entry-header -->
|
</div><!-- .entry-header -->
|
||||||
<?php rewind_posts(); ?>
|
<?php rewind_posts(); ?>
|
||||||
|
@ -41,7 +41,7 @@ get_header();
|
|||||||
echo wp_get_attachment_image( get_the_ID(), $image_size );
|
echo wp_get_attachment_image( get_the_ID(), $image_size );
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<figcaption class="wp-caption-text"><?php echo get_the_excerpt(); ?></figcaption>
|
<figcaption class="wp-caption-text"><?php the_excerpt(); ?></figcaption>
|
||||||
|
|
||||||
</figure><!-- .entry-attachment -->
|
</figure><!-- .entry-attachment -->
|
||||||
|
|
||||||
|
@ -12,10 +12,9 @@
|
|||||||
*/
|
*/
|
||||||
function twentynineteen_custom_colors_css() {
|
function twentynineteen_custom_colors_css() {
|
||||||
|
|
||||||
if ( 'default' === get_theme_mod( 'primary_color', 'default' ) ) {
|
$primary_color = 199;
|
||||||
$primary_color = 199;
|
if ( 'default' !== get_theme_mod( 'primary_color', 'default' ) ) {
|
||||||
} else {
|
$primary_color = absint( get_theme_mod( 'primary_color', 199 ) );
|
||||||
$primary_color = absint( get_theme_mod( 'primary_color_hue', 199 ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,21 +24,48 @@ function twentynineteen_custom_colors_css() {
|
|||||||
*
|
*
|
||||||
* @param int $saturation Color saturation level.
|
* @param int $saturation Color saturation level.
|
||||||
*/
|
*/
|
||||||
|
$saturation = apply_filters( 'twentynineteen_custom_colors_saturation', 100 );
|
||||||
|
$saturation = absint( $saturation ) . '%';
|
||||||
|
|
||||||
$saturation = absint( apply_filters( 'twentynineteen_custom_colors_saturation', 100 ) );
|
/**
|
||||||
$saturation = $saturation . '%';
|
* Filter Twenty Nineteen default selection saturation level.
|
||||||
|
*
|
||||||
|
* @since Twenty Nineteen 1.0
|
||||||
|
*
|
||||||
|
* @param int $saturation_selection Selection color saturation level.
|
||||||
|
*/
|
||||||
$saturation_selection = absint( apply_filters( 'twentynineteen_custom_colors_saturation_selection', 50 ) );
|
$saturation_selection = absint( apply_filters( 'twentynineteen_custom_colors_saturation_selection', 50 ) );
|
||||||
$saturation_selection = $saturation_selection . '%';
|
$saturation_selection = $saturation_selection . '%';
|
||||||
|
|
||||||
$lightness = absint( apply_filters( 'twentynineteen_custom_colors_lightness', 33 ) );
|
/**
|
||||||
$lightness = $lightness . '%';
|
* Filter Twenty Nineteen default lightness level.
|
||||||
|
*
|
||||||
|
* @since Twenty Nineteen 1.0
|
||||||
|
*
|
||||||
|
* @param int $lightness Color lightness level.
|
||||||
|
*/
|
||||||
|
$lightness = apply_filters( 'twentynineteen_custom_colors_lightness', 33 );
|
||||||
|
$lightness = absint( $lightness ) . '%';
|
||||||
|
|
||||||
$lightness_hover = absint( apply_filters( 'twentynineteen_custom_colors_lightness_hover', 23 ) );
|
/**
|
||||||
$lightness_hover = $lightness_hover . '%';
|
* Filter Twenty Nineteen default hover lightness level.
|
||||||
|
*
|
||||||
|
* @since Twenty Nineteen 1.0
|
||||||
|
*
|
||||||
|
* @param int $lightness_hover Hover color lightness level.
|
||||||
|
*/
|
||||||
|
$lightness_hover = apply_filters( 'twentynineteen_custom_colors_lightness_hover', 23 );
|
||||||
|
$lightness_hover = absint( $lightness_hover ) . '%';
|
||||||
|
|
||||||
$lightness_selection = absint( apply_filters( 'twentynineteen_custom_colors_lightness_selection', 90 ) );
|
/**
|
||||||
$lightness_selection = $lightness_selection . '%';
|
* Filter Twenty Nineteen default selection lightness level.
|
||||||
|
*
|
||||||
|
* @since Twenty Nineteen 1.0
|
||||||
|
*
|
||||||
|
* @param int $lightness_selection Selection color lightness level.
|
||||||
|
*/
|
||||||
|
$lightness_selection = apply_filters( 'twentynineteen_custom_colors_lightness_selection', 90 );
|
||||||
|
$lightness_selection = absint( $lightness_selection ) . '%';
|
||||||
|
|
||||||
$theme_css = '
|
$theme_css = '
|
||||||
/*
|
/*
|
||||||
@ -233,11 +259,9 @@ function twentynineteen_custom_colors_css() {
|
|||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
';
|
';
|
||||||
$css = '';
|
|
||||||
if ( function_exists( 'register_block_type' ) && is_admin() ) {
|
if ( function_exists( 'register_block_type' ) && is_admin() ) {
|
||||||
$css .= $editor_css;
|
$theme_css = $editor_css;
|
||||||
} elseif ( ! is_admin() ) {
|
|
||||||
$css = $theme_css;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -249,5 +273,5 @@ function twentynineteen_custom_colors_css() {
|
|||||||
* @param int $primary_color The user's selected color hue.
|
* @param int $primary_color The user's selected color hue.
|
||||||
* @param string $saturation Filtered theme color saturation level.
|
* @param string $saturation Filtered theme color saturation level.
|
||||||
*/
|
*/
|
||||||
return apply_filters( 'twentynineteen_custom_colors_css', $css, $primary_color, $saturation );
|
return apply_filters( 'twentynineteen_custom_colors_css', $theme_css, $primary_color, $saturation );
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ function twentynineteen_customize_partial_blogdescription() {
|
|||||||
* Bind JS handlers to instantly live-preview changes.
|
* Bind JS handlers to instantly live-preview changes.
|
||||||
*/
|
*/
|
||||||
function twentynineteen_customize_preview_js() {
|
function twentynineteen_customize_preview_js() {
|
||||||
wp_enqueue_script( 'twentynineteen-customize-preview', get_theme_file_uri( '/js/customize-preview.js' ), array( 'customize-preview' ), '20151215', true );
|
wp_enqueue_script( 'twentynineteen-customize-preview', get_theme_file_uri( '/js/customize-preview.js' ), array( 'customize-preview' ), '20181108', true );
|
||||||
}
|
}
|
||||||
add_action( 'customize_preview_init', 'twentynineteen_customize_preview_js' );
|
add_action( 'customize_preview_init', 'twentynineteen_customize_preview_js' );
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ add_action( 'customize_preview_init', 'twentynineteen_customize_preview_js' );
|
|||||||
* Load dynamic logic for the customizer controls area.
|
* Load dynamic logic for the customizer controls area.
|
||||||
*/
|
*/
|
||||||
function twentynineteen_panels_js() {
|
function twentynineteen_panels_js() {
|
||||||
wp_enqueue_script( 'twentynineteen-customize-controls', get_theme_file_uri( '/js/customize-controls.js' ), array(), '1.0', true );
|
wp_enqueue_script( 'twentynineteen-customize-controls', get_theme_file_uri( '/js/customize-controls.js' ), array(), '20181031', true );
|
||||||
}
|
}
|
||||||
add_action( 'customize_controls_enqueue_scripts', 'twentynineteen_panels_js' );
|
add_action( 'customize_controls_enqueue_scripts', 'twentynineteen_panels_js' );
|
||||||
|
|
||||||
|
@ -106,10 +106,7 @@ function twentynineteen_can_show_post_thumbnail() {
|
|||||||
* Returns true if image filters are enabled on the theme options.
|
* Returns true if image filters are enabled on the theme options.
|
||||||
*/
|
*/
|
||||||
function twentynineteen_image_filters_enabled() {
|
function twentynineteen_image_filters_enabled() {
|
||||||
if ( get_theme_mod( 'image_filter', 1 ) ) {
|
return 'inactive' !== get_theme_mod( 'image_filter', 1 );
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -418,8 +415,7 @@ function twentynineteen_hsl_hex( $h, $s, $l, $to_hex = true ) {
|
|||||||
|
|
||||||
return "#$r$g$b";
|
return "#$r$g$b";
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
return "rgb($r, $g, $b)";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return "rgb($r, $g, $b)";
|
||||||
}
|
}
|
||||||
|
@ -157,9 +157,7 @@ if ( ! function_exists( 'twentynineteen_post_thumbnail' ) ) :
|
|||||||
|
|
||||||
<figure class="post-thumbnail">
|
<figure class="post-thumbnail">
|
||||||
<a class="post-thumbnail-inner" href="<?php the_permalink(); ?>" aria-hidden="true" tabindex="-1">
|
<a class="post-thumbnail-inner" href="<?php the_permalink(); ?>" aria-hidden="true" tabindex="-1">
|
||||||
<?php
|
<?php the_post_thumbnail( 'post-thumbnail' ); ?>
|
||||||
the_post_thumbnail( 'post-thumbnail' );
|
|
||||||
?>
|
|
||||||
</a>
|
</a>
|
||||||
</figure>
|
</figure>
|
||||||
|
|
||||||
@ -223,13 +221,19 @@ if ( ! function_exists( 'twentynineteen_the_posts_navigation' ) ) :
|
|||||||
* Documentation for function.
|
* Documentation for function.
|
||||||
*/
|
*/
|
||||||
function twentynineteen_the_posts_navigation() {
|
function twentynineteen_the_posts_navigation() {
|
||||||
$prev_icon = twentynineteen_get_icon_svg( 'chevron_left', 22 );
|
|
||||||
$next_icon = twentynineteen_get_icon_svg( 'chevron_right', 22 );
|
|
||||||
the_posts_pagination(
|
the_posts_pagination(
|
||||||
array(
|
array(
|
||||||
'mid_size' => 2,
|
'mid_size' => 2,
|
||||||
'prev_text' => sprintf( '%s <span class="nav-prev-text">%s</span>', $prev_icon, __( 'Newer posts', 'twentynineteen' ) ),
|
'prev_text' => sprintf(
|
||||||
'next_text' => sprintf( '<span class="nav-next-text">%s</span> %s', __( 'Older posts', 'twentynineteen' ), $next_icon ),
|
'%s <span class="nav-prev-text">%s</span>',
|
||||||
|
twentynineteen_get_icon_svg( 'chevron_left', 22 ),
|
||||||
|
__( 'Newer posts', 'twentynineteen' )
|
||||||
|
),
|
||||||
|
'next_text' => sprintf(
|
||||||
|
'<span class="nav-next-text">%s</span> %s',
|
||||||
|
__( 'Older posts', 'twentynineteen' ),
|
||||||
|
twentynineteen_get_icon_svg( 'chevron_right', 22 )
|
||||||
|
),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ get_header();
|
|||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</main><!-- .site-main -->
|
</main><!-- .site-main -->
|
||||||
</section><!-- .content-area -->
|
</section><!-- .content-area -->
|
||||||
|
|
||||||
|
@ -45,6 +45,9 @@
|
|||||||
width: 32px;
|
width: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
|
|
||||||
|
// Prevent icons from jumping in Safari using hardware acceleration.
|
||||||
|
transform: translateZ(0);
|
||||||
|
|
||||||
&#ui-icon-link {
|
&#ui-icon-link {
|
||||||
transform: rotate(-45deg);
|
transform: rotate(-45deg);
|
||||||
}
|
}
|
||||||
|
@ -1604,6 +1604,7 @@ body.page .main-navigation {
|
|||||||
display: block;
|
display: block;
|
||||||
width: 32px;
|
width: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
|
transform: translateZ(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.social-navigation ul.social-links-menu li a svg#ui-icon-link {
|
.social-navigation ul.social-links-menu li a svg#ui-icon-link {
|
||||||
|
@ -1604,6 +1604,7 @@ body.page .main-navigation {
|
|||||||
display: block;
|
display: block;
|
||||||
width: 32px;
|
width: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
|
transform: translateZ(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.social-navigation ul.social-links-menu li a svg#ui-icon-link {
|
.social-navigation ul.social-links-menu li a svg#ui-icon-link {
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.1-alpha-44297';
|
$wp_version = '5.1-alpha-44298';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user